Merge pull request #164 from meienberger/feature/improve-docker-build

Feature/improve docker build
This commit is contained in:
Nicolas Meienberger 2022-08-30 06:10:48 +00:00 committed by GitHub
commit 80148c5ae3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 91 additions and 92 deletions

View file

@ -1,45 +1,25 @@
FROM node:18 AS build
RUN npm install node-gyp -g
WORKDIR /api
COPY ./packages/system-api/package.json /api/package.json
RUN npm i
# ---
WORKDIR /dashboard
COPY ./packages/dashboard/package.json /dashboard/package.json
RUN npm i
WORKDIR /api
COPY ./packages/system-api /api
RUN npm run build
# ---
WORKDIR /dashboard
COPY ./packages/dashboard /dashboard
RUN npm run build
FROM alpine:3.16.0 as app
WORKDIR /
# Install dependencies
RUN apk --no-cache add docker-compose nodejs npm bash g++ make git
RUN npm install node-gyp -g
WORKDIR /api
COPY ./packages/system-api/package*.json /api/
RUN npm install --production
RUN npm install --omit=dev
WORKDIR /dashboard
COPY ./packages/dashboard/package*.json /dashboard/
RUN npm install --production
RUN npm install --omit=dev
COPY --from=build /api/dist /api/dist
WORKDIR /api
COPY ./packages/system-api /api
COPY --from=build /dashboard/.next /dashboard/.next
RUN npm i -g @swc/cli @swc/core && npm run build && npm uninstall -g @swc/cli @swc/core
# ---
WORKDIR /dashboard
COPY ./packages/dashboard /dashboard
RUN npm i typescript @types/node && npm run build && npm uninstall typescript @types/node
WORKDIR /

View file

@ -3,7 +3,6 @@
"version": "0.5.0",
"description": "A homeserver for everyone",
"scripts": {
"test": "jest",
"prepare": "husky install",
"commit": "git-cz",
"act:test-install": "act --container-architecture linux/amd64 -j test-install",
@ -11,23 +10,16 @@
"start:dev": "docker-compose -f docker-compose.dev.yml --env-file .env.dev up --build",
"start:rc": "docker-compose -f docker-compose.rc.yml --env-file .env up --build",
"start:prod": "docker-compose --env-file .env up --build",
"build:common": "cd packages/common && npm run build",
"start:pg": "docker run --name test-db -p 5433:5432 -d --rm -e POSTGRES_PASSWORD=postgres postgres",
"version": "echo $npm_package_version"
},
"devDependencies": {
"@types/jest": "^27.5.0",
"@types/js-yaml": "^4.0.5",
"@types/node": "17.0.31",
"husky": "^8.0.1",
"jest": "^28.1.0",
"js-yaml": "^4.1.0",
"ts-jest": "^28.0.2",
"typescript": "4.6.4",
"@commitlint/cli": "^17.0.3",
"@commitlint/config-conventional": "^17.0.3",
"@commitlint/cz-commitlint": "^17.0.3",
"commitizen": "^4.2.4"
"commitizen": "^4.2.4",
"husky": "^8.0.1",
"inquirer": "8.2.4"
},
"repository": {
"type": "git",
@ -39,7 +31,6 @@
"url": "https://github.com/meienberger/runtipi/issues"
},
"homepage": "https://github.com/meienberger/runtipi#readme",
"dependencies": {},
"config": {
"commitizen": {
"path": "@commitlint/cz-commitlint"

View file

@ -60,8 +60,10 @@
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-next": "12.1.4",
"eslint-plugin-import": "^2.25.3",
"jest": "^28.1.0",
"postcss": "^8.4.12",
"tailwindcss": "^3.0.23",
"ts-jest": "^28.0.2",
"typescript": "4.6.4"
}
}

132
pnpm-lock.yaml generated
View file

@ -7,28 +7,16 @@ importers:
'@commitlint/cli': ^17.0.3
'@commitlint/config-conventional': ^17.0.3
'@commitlint/cz-commitlint': ^17.0.3
'@types/jest': ^27.5.0
'@types/js-yaml': ^4.0.5
'@types/node': 17.0.31
commitizen: ^4.2.4
husky: ^8.0.1
jest: ^28.1.0
js-yaml: ^4.1.0
ts-jest: ^28.0.2
typescript: 4.6.4
inquirer: 8.2.4
devDependencies:
'@commitlint/cli': 17.0.3
'@commitlint/config-conventional': 17.0.3
'@commitlint/cz-commitlint': 17.0.3_commitizen@4.2.5
'@types/jest': 27.5.0
'@types/js-yaml': 4.0.5
'@types/node': 17.0.31
'@commitlint/cz-commitlint': 17.0.3_yes7iyjckc3rubj3ixzwc3ince
commitizen: 4.2.5
husky: 8.0.1
jest: 28.1.0_@types+node@17.0.31
js-yaml: 4.1.0
ts-jest: 28.0.2_z3fx76c5ksuwr36so7o5uc2kcy
typescript: 4.6.4
inquirer: 8.2.4
packages/dashboard:
specifiers:
@ -62,6 +50,7 @@ importers:
graphql: ^15.8.0
graphql-tag: ^2.12.6
immer: ^9.0.12
jest: ^28.1.0
js-cookie: ^3.0.1
next: 12.1.6
postcss: ^8.4.12
@ -77,6 +66,7 @@ importers:
swr: ^1.3.0
systeminformation: ^5.11.9
tailwindcss: ^3.0.23
ts-jest: ^28.0.2
tslib: ^2.4.0
typescript: 4.6.4
validator: ^13.7.0
@ -129,8 +119,10 @@ importers:
eslint-config-airbnb-typescript: 17.0.0_r46exuh3jlhq2wmrnqx2ufqspa
eslint-config-next: 12.1.4_e6a2zi6fqdwfehht5cxvkmo3zu
eslint-plugin-import: 2.26.0_hhyjdrupy4c2vgtpytri6cjwoy
jest: 28.1.0_@types+node@17.0.31
postcss: 8.4.13
tailwindcss: 3.0.24
ts-jest: 28.0.2_ps5qfvt5fosg52obpfzuxthwve
typescript: 4.6.4
packages/system-api:
@ -761,7 +753,7 @@ packages:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.17.10
'@babel/helper-plugin-utils': 7.16.7
'@babel/helper-plugin-utils': 7.17.12
dev: true
/@babel/plugin-syntax-bigint/7.8.3_@babel+core@7.17.10:
@ -770,7 +762,7 @@ packages:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.17.10
'@babel/helper-plugin-utils': 7.16.7
'@babel/helper-plugin-utils': 7.17.12
dev: true
/@babel/plugin-syntax-class-properties/7.12.13_@babel+core@7.17.10:
@ -798,7 +790,7 @@ packages:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.17.10
'@babel/helper-plugin-utils': 7.16.7
'@babel/helper-plugin-utils': 7.17.12
dev: true
/@babel/plugin-syntax-json-strings/7.8.3_@babel+core@7.17.10:
@ -807,7 +799,7 @@ packages:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.17.10
'@babel/helper-plugin-utils': 7.16.7
'@babel/helper-plugin-utils': 7.17.12
dev: true
/@babel/plugin-syntax-jsx/7.16.7_@babel+core@7.17.10:
@ -835,7 +827,7 @@ packages:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.17.10
'@babel/helper-plugin-utils': 7.16.7
'@babel/helper-plugin-utils': 7.17.12
dev: true
/@babel/plugin-syntax-nullish-coalescing-operator/7.8.3_@babel+core@7.17.10:
@ -844,7 +836,7 @@ packages:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.17.10
'@babel/helper-plugin-utils': 7.16.7
'@babel/helper-plugin-utils': 7.17.12
dev: true
/@babel/plugin-syntax-numeric-separator/7.10.4_@babel+core@7.17.10:
@ -853,7 +845,7 @@ packages:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.17.10
'@babel/helper-plugin-utils': 7.16.7
'@babel/helper-plugin-utils': 7.17.12
dev: true
/@babel/plugin-syntax-object-rest-spread/7.8.3_@babel+core@7.17.10:
@ -871,7 +863,7 @@ packages:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.17.10
'@babel/helper-plugin-utils': 7.16.7
'@babel/helper-plugin-utils': 7.17.12
dev: true
/@babel/plugin-syntax-optional-chaining/7.8.3_@babel+core@7.17.10:
@ -880,7 +872,7 @@ packages:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.17.10
'@babel/helper-plugin-utils': 7.16.7
'@babel/helper-plugin-utils': 7.17.12
dev: true
/@babel/plugin-syntax-top-level-await/7.14.5_@babel+core@7.17.10:
@ -890,7 +882,7 @@ packages:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.17.10
'@babel/helper-plugin-utils': 7.16.7
'@babel/helper-plugin-utils': 7.17.12
dev: true
/@babel/plugin-syntax-typescript/7.17.10_@babel+core@7.17.10:
@ -900,7 +892,7 @@ packages:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.17.10
'@babel/helper-plugin-utils': 7.16.7
'@babel/helper-plugin-utils': 7.17.12
dev: true
/@babel/plugin-transform-arrow-functions/7.17.12_@babel+core@7.17.10:
@ -2033,7 +2025,7 @@ packages:
ajv: 8.11.0
dev: true
/@commitlint/cz-commitlint/17.0.3_commitizen@4.2.5:
/@commitlint/cz-commitlint/17.0.3_yes7iyjckc3rubj3ixzwc3ince:
resolution: {integrity: sha512-360I6wnaUWzc23D8Xn4B/cu8thy8GDJPZ4QsYk4xjVzDDyXZ6oXJB0+OlwkpWpSvjuLYAmEKiImvo0yLTASmlg==}
engines: {node: '>=v14'}
peerDependencies:
@ -2045,6 +2037,7 @@ packages:
'@commitlint/types': 17.0.0
chalk: 4.1.2
commitizen: 4.2.5
inquirer: 8.2.4
lodash: 4.17.21
word-wrap: 1.2.3
transitivePeerDependencies:
@ -3034,7 +3027,7 @@ packages:
chalk: 4.1.2
collect-v8-coverage: 1.0.1
exit: 0.1.2
glob: 7.2.0
glob: 7.2.3
graceful-fs: 4.2.10
istanbul-lib-coverage: 3.2.0
istanbul-lib-instrument: 5.2.0
@ -3650,8 +3643,8 @@ packages:
/@types/babel__core/7.1.19:
resolution: {integrity: sha512-WEOTgRsbYkvA/KCsDwVEGkd7WAr1e3g31VHQ8zy5gul/V1qKullU/BU5I68X5v7V3GnB9eotmom4v5a5gjxorw==}
dependencies:
'@babel/parser': 7.17.10
'@babel/types': 7.17.10
'@babel/parser': 7.18.5
'@babel/types': 7.18.4
'@types/babel__generator': 7.6.4
'@types/babel__template': 7.4.1
'@types/babel__traverse': 7.17.1
@ -3660,20 +3653,20 @@ packages:
/@types/babel__generator/7.6.4:
resolution: {integrity: sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==}
dependencies:
'@babel/types': 7.17.10
'@babel/types': 7.18.4
dev: true
/@types/babel__template/7.4.1:
resolution: {integrity: sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==}
dependencies:
'@babel/parser': 7.17.10
'@babel/types': 7.17.10
'@babel/parser': 7.18.5
'@babel/types': 7.18.4
dev: true
/@types/babel__traverse/7.17.1:
resolution: {integrity: sha512-kVzjari1s2YVi77D3w1yuvohV2idweYXMCDzqBiVNN63TcDWrIlTVOYpqVrvbbyOE/IyzBoTKF0fdnLPEORFxA==}
dependencies:
'@babel/types': 7.17.10
'@babel/types': 7.18.4
dev: true
/@types/body-parser/1.19.2:
@ -4824,7 +4817,7 @@ packages:
resolution: {integrity: sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==}
engines: {node: '>=8'}
dependencies:
'@babel/helper-plugin-utils': 7.16.7
'@babel/helper-plugin-utils': 7.17.12
'@istanbuljs/load-nyc-config': 1.1.0
'@istanbuljs/schema': 0.1.3
istanbul-lib-instrument: 5.2.0
@ -4838,7 +4831,7 @@ packages:
engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0}
dependencies:
'@babel/template': 7.16.7
'@babel/types': 7.17.10
'@babel/types': 7.18.4
'@types/babel__core': 7.1.19
'@types/babel__traverse': 7.17.1
dev: true
@ -5369,7 +5362,7 @@ packages:
dev: false
/co/4.6.0:
resolution: {integrity: sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=}
resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==}
engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'}
dev: true
@ -6403,7 +6396,7 @@ packages:
eslint-import-resolver-webpack:
optional: true
dependencies:
'@typescript-eslint/parser': 5.22.0_hcfsmds2fshutdssjqluwm76uu
'@typescript-eslint/parser': 5.22.0_uhoeudlwl7kc47h4kncsfowede
debug: 3.2.7
eslint-import-resolver-node: 0.3.6
find-up: 2.1.0
@ -6788,7 +6781,7 @@ packages:
strip-final-newline: 2.0.0
/exit/0.1.2:
resolution: {integrity: sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=}
resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==}
engines: {node: '>= 0.8.0'}
dev: true
@ -7332,7 +7325,6 @@ packages:
minimatch: 3.1.2
once: 1.4.0
path-is-absolute: 1.0.1
dev: true
/global-dirs/0.1.1:
resolution: {integrity: sha512-NknMLn7F2J7aflwFOlGdNIuCDpN3VGoSoB+aap3KABFWbHVn1TCgFC+np23J8W2BiZbjfEw3BFBycSMv1AFblg==}
@ -7800,7 +7792,7 @@ packages:
mute-stream: 0.0.8
ora: 5.4.1
run-async: 2.4.1
rxjs: 7.5.5
rxjs: 7.5.6
string-width: 4.2.3
strip-ansi: 6.0.1
through: 2.3.8
@ -8171,7 +8163,7 @@ packages:
engines: {node: '>=8'}
dependencies:
'@babel/core': 7.17.10
'@babel/parser': 7.17.10
'@babel/parser': 7.18.5
'@istanbuljs/schema': 0.1.3
istanbul-lib-coverage: 3.2.0
semver: 6.3.0
@ -8322,7 +8314,7 @@ packages:
chalk: 4.1.2
ci-info: 3.3.0
deepmerge: 4.2.2
glob: 7.2.0
glob: 7.2.3
graceful-fs: 4.2.10
jest-circus: 28.1.0
jest-environment-node: 28.1.0
@ -8597,7 +8589,7 @@ packages:
cjs-module-lexer: 1.2.2
collect-v8-coverage: 1.0.1
execa: 5.1.1
glob: 7.2.0
glob: 7.2.3
graceful-fs: 4.2.10
jest-haste-map: 28.1.0
jest-message-util: 28.1.0
@ -8617,10 +8609,10 @@ packages:
engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0}
dependencies:
'@babel/core': 7.17.10
'@babel/generator': 7.17.10
'@babel/generator': 7.18.2
'@babel/plugin-syntax-typescript': 7.17.10_@babel+core@7.17.10
'@babel/traverse': 7.17.10
'@babel/types': 7.17.10
'@babel/traverse': 7.18.5
'@babel/types': 7.18.4
'@jest/expect-utils': 28.1.0
'@jest/transform': 28.1.0
'@jest/types': 28.1.0
@ -9043,7 +9035,7 @@ packages:
dev: true
/lodash.memoize/4.1.2:
resolution: {integrity: sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=}
resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==}
dev: true
/lodash.merge/4.6.2:
@ -11246,7 +11238,7 @@ packages:
resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==}
hasBin: true
dependencies:
glob: 7.2.0
glob: 7.2.3
/run-async/2.4.1:
resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==}
@ -11266,8 +11258,8 @@ packages:
tslib: 1.14.1
dev: true
/rxjs/7.5.5:
resolution: {integrity: sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw==}
/rxjs/7.5.6:
resolution: {integrity: sha512-dnyv2/YsXhnm461G+R/Pe5bWP41Nm6LBXEYWI6eiFP4fiwx6WRI/CD0zbdVAudd9xwLEF2IDcKXLHit0FYjUzw==}
dependencies:
tslib: 2.4.0
dev: true
@ -11533,7 +11525,7 @@ packages:
dev: true
/sprintf-js/1.0.3:
resolution: {integrity: sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=}
resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==}
dev: true
/stack-trace/0.0.10:
@ -11861,7 +11853,7 @@ packages:
engines: {node: '>=8'}
dependencies:
'@istanbuljs/schema': 0.1.3
glob: 7.2.0
glob: 7.2.3
minimatch: 3.1.2
dev: true
@ -11986,6 +11978,40 @@ packages:
tslib: 2.4.0
dev: false
/ts-jest/28.0.2_ps5qfvt5fosg52obpfzuxthwve:
resolution: {integrity: sha512-IOZMb3D0gx6IHO9ywPgiQxJ3Zl4ECylEFwoVpENB55aTn5sdO0Ptyx/7noNBxAaUff708RqQL4XBNxxOVjY0vQ==}
engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0}
hasBin: true
peerDependencies:
'@babel/core': '>=7.0.0-beta.0 <8'
'@types/jest': ^27.0.0
babel-jest: ^28.0.0
esbuild: '*'
jest: ^28.0.0
typescript: '>=4.3'
peerDependenciesMeta:
'@babel/core':
optional: true
'@types/jest':
optional: true
babel-jest:
optional: true
esbuild:
optional: true
dependencies:
'@babel/core': 7.17.10
bs-logger: 0.2.6
fast-json-stable-stringify: 2.1.0
jest: 28.1.0_@types+node@17.0.31
jest-util: 28.1.0
json5: 2.2.1
lodash.memoize: 4.1.2
make-error: 1.3.6
semver: 7.3.7
typescript: 4.6.4
yargs-parser: 20.2.9
dev: true
/ts-jest/28.0.2_z3fx76c5ksuwr36so7o5uc2kcy:
resolution: {integrity: sha512-IOZMb3D0gx6IHO9ywPgiQxJ3Zl4ECylEFwoVpENB55aTn5sdO0Ptyx/7noNBxAaUff708RqQL4XBNxxOVjY0vQ==}
engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0}