mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
Prepare production version of backend
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
build
|
||||||
|
node_modules
|
||||||
+9
-4
@@ -1,12 +1,15 @@
|
|||||||
FROM node:20-alpine3.19 AS build
|
FROM node:20-alpine3.19 AS backend-build
|
||||||
|
|
||||||
ENV TZ="Europe/Helsinki"
|
ENV TZ="Europe/Helsinki"
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
COPY package*.json ./
|
COPY package.json ./
|
||||||
|
COPY package-lock.json ./
|
||||||
|
|
||||||
RUN npm install
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
@@ -16,8 +19,10 @@ FROM node:20-alpine3.19 AS node-run
|
|||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
COPY --from=build /usr/src/app/build /usr/src/app
|
COPY --from=backend-build /usr/src/app/build /usr/src/app/build
|
||||||
|
COPY --from=backend-build /usr/src/app/node_modules /usr/src/app/node_modules
|
||||||
|
|
||||||
EXPOSE 4000
|
EXPOSE 4000
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
CMD ["node", "build/index.js"]
|
CMD ["node", "build/index.js"]
|
||||||
|
|||||||
@@ -6,4 +6,6 @@ export const MARIADB_PASSWORD = process.env.MARIADB_PASSWORD as string
|
|||||||
export const SECRET = process.env.SECRET as string
|
export const SECRET = process.env.SECRET as string
|
||||||
export const PORT = process.env.NOWDB_BACKEND_PORT as unknown as number
|
export const PORT = process.env.NOWDB_BACKEND_PORT as unknown as number
|
||||||
export const LOGIN_VALID_MS = parseInt(process.env.LOGIN_VALID_MINUTES as string) * 60 * 1000
|
export const LOGIN_VALID_MS = parseInt(process.env.LOGIN_VALID_MINUTES as string) * 60 * 1000
|
||||||
export const MARIADB_PORT = parseInt(process.env.MARIADB_PORT as string)
|
export const MARIADB_PORT = parseInt(process.env.MARIADB_PORT as string)
|
||||||
|
export const USER_CREATION_SECRET = process.env.USER_CREATION_SECRET as string
|
||||||
|
export const BACKEND_MODE = (process.env.BACKEND_MODE as 'dev' | 'prod' | 'test')
|
||||||
+1
-3
@@ -14,9 +14,7 @@ services:
|
|||||||
container_name: nowdb-backend
|
container_name: nowdb-backend
|
||||||
build:
|
build:
|
||||||
context: backend/
|
context: backend/
|
||||||
env_file: .db.dev.env
|
env_file: .db.env
|
||||||
volumes:
|
|
||||||
- ./backend/:/usr/src/app
|
|
||||||
ports:
|
ports:
|
||||||
- 4000:4000
|
- 4000:4000
|
||||||
db:
|
db:
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
dist
|
||||||
+1
-1
@@ -7,7 +7,7 @@ WORKDIR /app
|
|||||||
COPY package.json ./
|
COPY package.json ./
|
||||||
COPY package-lock.json ./
|
COPY package-lock.json ./
|
||||||
|
|
||||||
RUN npm install
|
RUN npm ci
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user