2023-08-08 21:24:24 +03:00
|
|
|
FROM node:18 as backend-ts-compiler
|
2022-04-27 23:51:08 +03:00
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
2022-04-28 03:22:20 +03:00
|
|
|
COPY tsconfig*.json ./
|
|
|
|
RUN npm install
|
2022-04-27 23:51:08 +03:00
|
|
|
COPY . .
|
|
|
|
RUN npm run build
|
|
|
|
|
2023-08-08 21:24:24 +03:00
|
|
|
FROM node:18 as frontend-compiler
|
2022-04-27 23:51:08 +03:00
|
|
|
WORKDIR /app/frontend
|
2022-04-28 03:22:20 +03:00
|
|
|
COPY --from=backend-ts-compiler /app/frontend/package*.json ./
|
|
|
|
RUN npm install
|
|
|
|
COPY --from=backend-ts-compiler /app/frontend/ ./
|
2022-04-27 23:51:08 +03:00
|
|
|
RUN npm run build
|
|
|
|
|
2023-08-08 21:24:24 +03:00
|
|
|
FROM node:18 as strip-dev-deps
|
2022-04-27 23:51:08 +03:00
|
|
|
WORKDIR /app
|
2022-04-28 03:22:20 +03:00
|
|
|
COPY --from=backend-ts-compiler /app/package*.json ./
|
|
|
|
COPY --from=backend-ts-compiler /app/dist ./
|
|
|
|
RUN npm install --only=production
|
2022-04-27 23:51:08 +03:00
|
|
|
|
2023-08-08 21:24:24 +03:00
|
|
|
FROM node:18
|
2022-04-28 03:22:20 +03:00
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=strip-dev-deps /app ./
|
|
|
|
COPY --from=frontend-compiler /app/frontend/public ./frontend/public
|
|
|
|
RUN echo "JWT_SECRET=$(openssl rand -base64 256 | tr -d '\n')" > .env
|
|
|
|
USER node
|
2023-08-08 21:24:24 +03:00
|
|
|
CMD [ "/bin/sh", "-c", "node index.js" ]
|