-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
44 lines (32 loc) · 873 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
36
37
38
39
40
41
42
43
44
### STAGE 1: Build ###
# This image is around 50 megabytes
FROM node:18-alpine3.18 AS builder
# Create app directory
WORKDIR /app
# Copy all files from the repo to /app
COPY /public ./public
COPY /src ./src
COPY index.html .
COPY package*.json .
COPY tsconfig.json .
COPY vite.config.ts .
# Install app dependencies
RUN npm ci --verbose
# Build the ui
RUN npm run build
### STAGE 2: Run ###
# This image is around 5 megabytes
FROM nginx:1.25-alpine3.17-slim
COPY /nginx /etc/nginx/conf.d
EXPOSE 8080
EXPOSE 443
WORKDIR /usr/share/nginx/html
# Copy built source
COPY --from=builder /app/build .
# Copy override ENV script with default values
COPY ./env.sh .
COPY .env .
# Make our shell script executable
RUN chmod +x env.sh
# Start Nginx server with override ENV variables script
CMD ["/bin/sh", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]