aboutsummaryrefslogtreecommitdiffstats
path: root/spring-front/Dockerfile
blob: 5e236e66be33f73d8b6491f03f8cd44b86f9a634 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
FROM node:lts-alpine3.15 as certbuilder
RUN apk add openssl
WORKDIR /certs
RUN openssl req -nodes -new -x509 -subj="/C=US/ST=Denial/L=springfield/O=Dis/CN=localhost" -keyout server.key -out server.cert

FROM node:16.14.2-alpine as builder
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY package.json ./
COPY package-lock.json ./
RUN npm ci --production
RUN npm install react-scripts -g
COPY ./public/ ./public/
COPY ./src/ ./src/
RUN npm run build

FROM nginx:stable-alpine
COPY --from=builder /app/build /usr/share/nginx/html
COPY --from=certbuilder /certs /certs
CMD ["nginx", "-g", "daemon off;"]