-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (45 loc) · 1.21 KB
/
Dockerfile
File metadata and controls
64 lines (45 loc) · 1.21 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# ===========
# Global Args
# ===========
# This is automagically shared to yarn and npm
ARG APP_DIR=/usr/app
# ====================
# Stage 0: Development
# ====================
# Base Image: node:16-alpine
FROM node:12-alpine AS build
# -----------------
# Stage 0 Arguments
# -----------------
ARG APP_DIR
WORKDIR $APP_DIR
## Install devdependencies first for building time to cache
COPY ["./package*.json", "./yarn.lock", "./tsconfig.json", "./"]
COPY ["./server/package*.json", "./yarn.lock", "./server/"]
RUN yarn install --ignore-scripts
# check files list
RUN ls -a
COPY . .
RUN yarn build-server
# ========================
# Stage 1: Run application
# ========================
# Base Image: node:16-alpine
FROM node:12-alpine
# -----------------
# Stage 1 Arguments
# -----------------
ARG APP_DIR
# -----------------------------
# Stage 1 Environment Variables
# -----------------------------
ENV PORT=3000
WORKDIR $APP_DIR/server
## Install production dependencies first for cache
COPY --from=build $APP_DIR/node_modules ./node_modules
COPY [ "./server/package*.json", "./" ]
COPY [ "./schema.graphql", "../" ]
COPY --from=build $APP_DIR/server/dist ./dist
RUN ls -a
EXPOSE $PORT
CMD [ "yarn", "start" ]