Feature/cypressio
This commit is contained in:
committed by
Jean-Baptiste Pasquier
parent
beed19cb42
commit
9df738a15f
37
docker/front.docker
Normal file
37
docker/front.docker
Normal file
@ -0,0 +1,37 @@
|
||||
FROM node:12 AS builder
|
||||
LABEL maintainer="Plup <plup@plup.io>"
|
||||
|
||||
# install dependencies
|
||||
WORKDIR /build
|
||||
ADD package.json package-lock.json ./
|
||||
ADD src/ src/
|
||||
RUN npm install --only=production
|
||||
|
||||
# build the app
|
||||
ADD docker/config.json .
|
||||
RUN npm run build
|
||||
|
||||
# change index to template
|
||||
RUN mv /build/dist/index.html /build/dist/index.tpl
|
||||
|
||||
# generate a self signed certificate
|
||||
RUN openssl req -x509 -newkey rsa:4096 -keyout /tmp/key.pem -out /tmp/cert.pem -days 365 -nodes -subj '/CN=localhost'
|
||||
|
||||
# serve
|
||||
FROM nginx:latest
|
||||
COPY --from=builder /build/dist /var/www
|
||||
COPY --from=builder /tmp/*.pem /etc/nginx/
|
||||
WORKDIR /var/www
|
||||
|
||||
# get specific config
|
||||
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 443
|
||||
|
||||
# get server address
|
||||
ENV SERVER http://localhost:8000
|
||||
|
||||
# replace addresses at runtime
|
||||
CMD /bin/bash -c "envsubst '\$SERVER' < index.tpl > index.html && \
|
||||
exec nginx -g 'daemon off;'"
|
||||
|
||||
# vim: ft=dockerfile:
|
Reference in New Issue
Block a user