-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
http.Dockerfile
38 lines (28 loc) · 774 Bytes
/
http.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
FROM node:18.12.1-alpine as build
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY package.json ./
COPY yarn.lock ./
COPY src ./src
COPY public ./public
COPY src/config.prod.js ./src/config.js
RUN yarn install --network-timeout 300000
COPY . ./
RUN yarn build
# Production environment
FROM nginx:stable-alpine
RUN rm -rf /etc/nginx/conf.d
COPY nginx/conf /etc/nginx
# Static build
COPY --from=build /app/build /usr/share/nginx/html
# Copy .env file and shell script to container
WORKDIR /usr/share/nginx/html
COPY ./env.sh .
COPY .env .
# Make our shell script executable
RUN chmod +x env.sh
# Add bash
RUN apk add --no-cache bash
RUN ls -l /usr/share/nginx/html
EXPOSE 80
CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]