forked from badger-cash/cashtab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
34 lines (28 loc) · 898 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
# Multi-stage
# 1) Node image for building frontend assets
# 2) nginx stage to serve frontend assets
# Stage 1
FROM node:15-buster-slim AS builder
# Install some dependencies before building
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y git && \
apt-get install -y python
WORKDIR /app
# Copy only the package files and install necessary dependencies.
# This reduces cache busting when source files are changed.
COPY package.json .
COPY package-lock.json .
RUN npm ci
# Copy the rest of the project files and build
COPY . .
RUN npm run build
# Stage 2
FROM nginx
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Set working directory to nginx asset directory
# Copy static assets from builder stage
COPY --from=builder /app/build /usr/share/nginx/html/
EXPOSE 80
# Containers run nginx with global directives and daemon off
ENTRYPOINT ["nginx", "-g", "daemon off;"]