-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.aws
More file actions
68 lines (57 loc) · 1.4 KB
/
Dockerfile.aws
File metadata and controls
68 lines (57 loc) · 1.4 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
65
66
67
68
# Stage 1: Builder
FROM public.ecr.aws/docker/library/node:lts-slim AS builder
WORKDIR /app
# Install all deps including devDependencies so we can compile TS
COPY package*.json ./
RUN npm ci
# Copy source code and build
COPY tsconfig.json ./
COPY src ./src
RUN npm run build # should output to dist/
# Remove all the unecessary test and mock files from the distribution
RUN rm -rf dist/__tests__ \
dist/__mocks__ \
dist/**/__tests__ \
dist/**/__mocks__
# Stage 2: Production Image
FROM public.ecr.aws/docker/library/node:lts-slim AS runner
RUN apt-get update && apt-get install -y --no-install-recommends \
bash \
curl \
nodejs \
npm \
chromium \
ca-certificates \
fonts-freefont-ttf \
fonts-dejavu \
fonts-liberation \
fonts-noto-cjk \
fonts-roboto \
fonts-croscore \
libasound2 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdbus-1-3 \
libdrm2 \
libgbm1 \
libgtk-3-0 \
libnss3 \
libx11-xcb1 \
libxcomposite1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxkbcommon0 \
libxrandr2 \
xdg-utils \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package.json & install only prod dependencies
COPY package*.json ./
RUN npm ci --omit=dev
# Copy compiled dist code from builder
COPY --from=builder /app/dist ./dist
# Expose API port
EXPOSE 4030
CMD ["node", "dist/server.js"]