-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDOCKERFILE
More file actions
31 lines (25 loc) · 901 Bytes
/
DOCKERFILE
File metadata and controls
31 lines (25 loc) · 901 Bytes
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
# build environment
FROM node:18 AS build
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY package.json ./
RUN npm config set maxsockets=5 # this is to avoid issues with slow unreliable internet connections
#COPY package-lock.json ./
RUN npm i --no-package-lock
COPY . ./
RUN npm run build
# production environment
FROM nginx:1.29.3-alpine
COPY --from=build /app/dist /usr/share/nginx/html
ARG SERVER_ENDPOINT=http://localhost:3000
ENV SERVER_ENDPOINT=$SERVER_ENDPOINT
# new
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf.template
RUN sed -i "s@\$SERVER_ENDPOINT@${SERVER_ENDPOINT}@g" /etc/nginx/conf.d/default.conf.template
RUN mv /etc/nginx/conf.d/default.conf.template /etc/nginx/conf.d/default.conf
EXPOSE 80
# Copy .env file and shell script to container
WORKDIR /usr/share/nginx/html
# Add bash
RUN apk add --no-cache bash
CMD ["/bin/bash", "-c", " nginx -g \"daemon off;\""]