-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
46 lines (32 loc) · 1.02 KB
/
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
45
46
# build stage
FROM node:16-alpine3.17 as build-stage
ARG FIREBASE_API_KEY
ENV FIREBASE_API_KEY=${FIREBASE_API_KEY}
ARG PROJECT_ID
ENV PROJECT_ID=${PROJECT_ID}
ARG MAPS_API_KEY
ENV MAPS_API_KEY=${MAPS_API_KEY}
ARG API_URL_SUB
ENV API_URL_SUB=${API_URL_SUB}
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
RUN npm ci
COPY . ./
RUN npm run build
# production stage
FROM nginx:stable-alpine as production-stage
# copy nginx conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
RUN apk add --no-cache bash
COPY --from=build-stage /app/dist /usr/share/nginx/html
#COPY env.sh /usr/share/nginx/html
#COPY .env /usr/share/nginx/html
#RUN chmod +x /usr/share/nginx/html/env.sh
WORKDIR /usr/share/nginx/html
# Cloud Run requires port 8080. Let's change nginx...
RUN sed -i 's/80/8080/g' /etc/nginx/conf.d/default.conf
RUN sed -i 's/$PORT/8080/g' /etc/nginx/conf.d/default.conf
EXPOSE 8080
#CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]
CMD ["/bin/bash", "-c", "nginx -g \"daemon off;\""]