docker support

This commit is contained in:
Evert Prants 2022-11-27 10:14:01 +02:00
parent 3d97f6659e
commit 5a40b44dd1
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
5 changed files with 65 additions and 6 deletions

7
.dockerignore Normal file
View File

@ -0,0 +1,7 @@
devdocker/
dist/
node_modules/
private/
*.toml
uploads/*
.env

50
Dockerfile Normal file
View File

@ -0,0 +1,50 @@
###################
# BUILD FOR LOCAL DEVELOPMENT
###################
FROM node:18-alpine As development
USER node
WORKDIR /usr/src/app
COPY --chown=node:node package*.json ./
RUN npm ci
COPY --chown=node:node . .
###################
# BUILD FOR PRODUCTION
###################
FROM node:18-alpine As build
USER node
WORKDIR /usr/src/app
COPY --chown=node:node package*.json ./
COPY --chown=node:node --from=development /usr/src/app/node_modules ./node_modules
COPY --chown=node:node . .
RUN npm run build
ENV NODE_ENV production
RUN npm ci --omit=dev && npm cache clean --force
###################
# PRODUCTION
###################
FROM node:18-alpine As production
USER node
WORKDIR /app
COPY --chown=node:node --from=build /usr/src/app/node_modules ./node_modules
COPY --chown=node:node --from=build /usr/src/app/dist ./dist
COPY --chown=node:node --from=build /usr/src/app/views ./views
COPY --chown=node:node --from=build /usr/src/app/public ./public
COPY --chown=node:node --from=build /usr/src/app/package*.json ./package*.json
CMD [ "node", "dist/main.js" ]

11
package-lock.json generated
View File

@ -9,7 +9,7 @@
"version": "0.0.1", "version": "0.0.1",
"license": "UNLICENSED", "license": "UNLICENSED",
"dependencies": { "dependencies": {
"@icynet/oauth2-provider": "git+https://gitlab.icynet.eu/IcyNetwork/oauth2-provider.git", "@icynet/oauth2-provider": "^1.0.6",
"@nestjs/common": "^9.0.11", "@nestjs/common": "^9.0.11",
"@nestjs/core": "^9.0.11", "@nestjs/core": "^9.0.11",
"@nestjs/platform-express": "^9.0.11", "@nestjs/platform-express": "^9.0.11",
@ -2143,8 +2143,8 @@
}, },
"node_modules/@icynet/oauth2-provider": { "node_modules/@icynet/oauth2-provider": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "git+https://gitlab.icynet.eu/IcyNetwork/oauth2-provider.git#ef4a5abac9f3cc2ef9e5476ea3b4ae28e337cb8c", "resolved": "https://registry.npmjs.org/@icynet/oauth2-provider/-/oauth2-provider-1.0.6.tgz",
"license": "MIT", "integrity": "sha512-CsPQZB0Jbzxll4re34aPtZFVNkeeWtC4aW9UZCg8U57fPL8/Xe/2dfnigxdn4r9jVdd6d/qiFSh5x7wrFUmYrw==",
"dependencies": { "dependencies": {
"express": "^4.17.3", "express": "^4.17.3",
"express-session": "^1.17.2" "express-session": "^1.17.2"
@ -14155,8 +14155,9 @@
"dev": true "dev": true
}, },
"@icynet/oauth2-provider": { "@icynet/oauth2-provider": {
"version": "git+https://gitlab.icynet.eu/IcyNetwork/oauth2-provider.git#ef4a5abac9f3cc2ef9e5476ea3b4ae28e337cb8c", "version": "1.0.6",
"from": "@icynet/oauth2-provider@git+https://gitlab.icynet.eu/IcyNetwork/oauth2-provider.git", "resolved": "https://registry.npmjs.org/@icynet/oauth2-provider/-/oauth2-provider-1.0.6.tgz",
"integrity": "sha512-CsPQZB0Jbzxll4re34aPtZFVNkeeWtC4aW9UZCg8U57fPL8/Xe/2dfnigxdn4r9jVdd6d/qiFSh5x7wrFUmYrw==",
"requires": { "requires": {
"express": "^4.17.3", "express": "^4.17.3",
"express-session": "^1.17.2" "express-session": "^1.17.2"

View File

@ -24,7 +24,7 @@
"test:e2e": "jest --config ./test/jest-e2e.json" "test:e2e": "jest --config ./test/jest-e2e.json"
}, },
"dependencies": { "dependencies": {
"@icynet/oauth2-provider": "git+https://gitlab.icynet.eu/IcyNetwork/oauth2-provider.git", "@icynet/oauth2-provider": "^1.0.6",
"@nestjs/common": "^9.0.11", "@nestjs/common": "^9.0.11",
"@nestjs/core": "^9.0.11", "@nestjs/core": "^9.0.11",
"@nestjs/platform-express": "^9.0.11", "@nestjs/platform-express": "^9.0.11",

View File

@ -252,6 +252,7 @@ export class UserService {
user.username = newUserInfo.username; user.username = newUserInfo.username;
user.display_name = newUserInfo.display_name; user.display_name = newUserInfo.display_name;
user.password = hashword; user.password = hashword;
user.activity_at = new Date();
await this.userRepository.insert(user); await this.userRepository.insert(user);