-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile-frontend
More file actions
30 lines (27 loc) · 952 Bytes
/
dockerfile-frontend
File metadata and controls
30 lines (27 loc) · 952 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
FROM node:12-alpine as build
RUN apk update
LABEL maintainer="Tutu Godfrey <godfrey_tutu@yahoo.com>"
LABEL description="Docker image for todo app frontend"
WORKDIR /app
COPY package.json* webpack.config.js .babelrc ./
RUN npm install
COPY client ./client
COPY public ./public
COPY nginx.conf ./
# API_URL is the url to forward api requests to backend server
# This may be the uri of an nginx if you are
# using nginx as a proxy server
# or the address (hostname, IP) of a load balancer server
ARG API_URL
ENV API_URL=${API_URL}
RUN echo API_URL=$API_URL >> .env
RUN echo API_URL= >> .env.example
RUN npm run build
# Use intermediate build
FROM nginx:latest
RUN apt update; apt install vim -y
WORKDIR /
COPY --from=build /app/public /usr/share/nginx/html/public/
COPY --from=build /app/public/index.html /usr/share/nginx/html/
COPY --from=build /app/public/bundle.js /usr/share/nginx/html/
COPY --from=build /app/nginx.conf /etc/nginx/nginx.conf