👷 Build with a Dockerfile

This commit is contained in:
ChatonDeAru 2024-03-23 17:52:33 +01:00
parent e1dabf4f06
commit 772ae1c8b8
No known key found for this signature in database
GPG Key ID: 3CADF765A409F755
7 changed files with 3277 additions and 2276 deletions

40
.dockerignore Normal file
View File

@ -0,0 +1,40 @@
Dockerfile*
.git
postgres
dump.sql
.DS_Store
node_modules*
build
.cache
## Tests
tests
*.tests.js
# local env files
.env.local
.env
.env.*.local
# Log files
*.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Yarn
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
.pnp.*

2
.yarnrc.yml Normal file
View File

@ -0,0 +1,2 @@
enableGlobalCache: false
nodeLinker: node-modules

36
Dockerfile Normal file
View File

@ -0,0 +1,36 @@
# App build
FROM node:20-alpine as build-stage
## Enable corepack for proper version of YARN
RUN corepack enable
WORKDIR /app
RUN apk add --no-cache \
libstdc++ \
build-base \
libtool \
autoconf \
automake \
elfutils-dev \
make \
cmake \
libcurl \
python3 \
nasm \
libjpeg-turbo-dev
ENV NODE_OPTIONS="--max_old_space_size=4096"
## Copy file for YARN then install all deps
COPY .yarnrc.yml yarn.lock* package.json ./
RUN yarn install --frozen-lockfile
COPY . .
## Build the app
RUN yarn run build
EXPOSE 8080
CMD ["yarn", "start"]

View File

@ -16,8 +16,6 @@ This project is open to contribution, but you will likely need to be in touch wi
### Requirements
- An account on GitHub
- [git](https://git-scm.com/)
- [node](https://nodejs.org/en) >= 12.0
@ -53,6 +51,11 @@ yarn dev # Build, hosts, and hot reload saved modifications
Now the app should be serving at <http://localhost:3000>.
## Using Docker
`docker build . -t force-orange`
`docker run -d -p 3000:8080 -t force-orange`
### Commands
This repository comes with build-ins commands to run while developping.

View File

@ -7,6 +7,7 @@
"homepage": "https://github.com/forceoranj/intranet",
"repository": "https://github.com/forceoranj/intranet",
"bugs": "https://github.com/forceoranj/intranet/issues",
"packageManager": "yarn@1.22.21",
"keywords": [
"starter",
"boilerplate",
@ -153,7 +154,7 @@
"@types/loadable__component": "^5.13.4",
"@types/loadable__server": "^5.12.6",
"@types/loadable__webpack-plugin": "^5.7.3",
"@types/mini-css-extract-plugin": "^2.2.0",
"@types/mini-css-extract-plugin": "^2.5.1",
"@types/morgan": "^1.9.3",
"@types/react-dom": "^17.0.8",
"@types/react-helmet": "^6.1.1",
@ -195,7 +196,7 @@
"imagemin-svgo": "^9.0.0",
"jest": "^27.0.6",
"lint-staged": "^11.0.0",
"mini-css-extract-plugin": "2.2.0",
"mini-css-extract-plugin": "^2.7.7",
"nodemon": "^2.0.9",
"npm-run-all": "^4.1.5",
"postcss": "^8.3.5",

View File

@ -17,7 +17,7 @@ const getPlugins = () => {
chunkFilename: isDev ? "[id].css" : "[id].[contenthash].css",
}),
new webpack.DefinePlugin(getClientEnvironment(["FORCE_ORANGE_PUBLIC_VAPID_KEY"])),
]
] as any[]
if (isDev)
plugins = [

5461
yarn.lock

File diff suppressed because it is too large Load Diff