forked from Lemoncode/code-paster
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (33 loc) · 805 Bytes
/
Dockerfile
File metadata and controls
39 lines (33 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM node:12-alpine AS base
RUN mkdir -p /usr/app
WORKDIR /usr/app
# Build front
FROM base AS build-frontend
ARG BASE_API_URL
ENV BASE_API_URL=$BASE_API_URL
ARG BASE_SOCKET_URL
ENV BASE_SOCKET_URL=$BASE_SOCKET_URL
COPY ./front ./
RUN npm ci
RUN npm run build
# Build backend
FROM base AS build-backend
COPY ./back ./
RUN npm ci
RUN npm run build
# Release
FROM base AS release
COPY --from=build-backend /usr/app/dist ./
COPY --from=build-frontend /usr/app/dist ./public
COPY ./back/package.json ./
COPY ./back/package-lock.json ./
RUN npm ci --only=production
EXPOSE 3000
ENV INTERNAL_PORT=3000
ENV NODE_ENV=production
ENV STATIC_FILES_PATH=./public
ENV MOCK_REPOSITORY=false
ENV CORS_ORIGIN=false
ENV API_URL=/api
RUN npm i pm2 -g
CMD pm2 start ./index.js --name "app" --env production --no-daemon