-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
35 lines (27 loc) · 964 Bytes
/
Dockerfile
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
# syntax=docker.io/docker/dockerfile:1.7-labs
FROM node:18-alpine AS builder
RUN apk --no-cache add \
g++ make python3 git \
&& yarn global add node-gyp \
&& rm -rf /var/cache/apk/*
WORKDIR /builder/
# Cache frontend's package
ADD package.json .
# ADD yarn.lock .
# Install dependencies
RUN yarn install --immutable --immutable-cache --check-cache
# Cache frontend's src
ADD --exclude=Dockerfile . .
# Build
ADD prod.env src/.env.production
ENV NODE_OPTIONS="--max-old-space-size=5632"
RUN yarn build --mode production
# ===== Image =====
# ==================
## frontend Image
FROM nginx:alpine AS frontend
COPY nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /builder/dist/ /usr/share/nginx/html
COPY --from=builder /builder/src/assets/logos /usr/share/nginx/html/assets
COPY --from=builder /builder/src/assets/icons /usr/share/nginx/html/assets
COPY --from=builder /builder/src/assets/images /usr/share/nginx/html/assets