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"
|
||||
|
||||
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 . .
|
||||
|
||||
@@ -16,8 +19,10 @@ FROM node:20-alpine3.19 AS node-run
|
||||
|
||||
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
|
||||
ENV NODE_ENV=production
|
||||
|
||||
CMD ["node", "build/index.js"]
|
||||
|
||||
@@ -7,3 +7,5 @@ export const SECRET = process.env.SECRET as string
|
||||
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 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
|
||||
build:
|
||||
context: backend/
|
||||
env_file: .db.dev.env
|
||||
volumes:
|
||||
- ./backend/:/usr/src/app
|
||||
env_file: .db.env
|
||||
ports:
|
||||
- 4000:4000
|
||||
db:
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
dist
|
||||
+1
-1
@@ -7,7 +7,7 @@ WORKDIR /app
|
||||
COPY package.json ./
|
||||
COPY package-lock.json ./
|
||||
|
||||
RUN npm install
|
||||
RUN npm ci
|
||||
|
||||
COPY . .
|
||||
|
||||
|
||||
Reference in New Issue
Block a user