diceware/Dockerfile
Sven Strittmatter 965e503aec Adds Dockerfile to build a container image which hosts diceware
The container is built in two steps (docker builder pattern):

1. Node/npm build stage
2. Final image with Nginx and static files to serve

Build the mage with this command:

    docker image build -t dceware .

Run a container with this command:

    docker run --rm -p 8080:80  dceware

Then you can visit your local diceware at:

http://localhost:8080/

Signed-off-by: Sven Strittmatter <ich@weltraumschaf.de>
2023-06-10 12:54:59 -04:00

18 lines
636 B
Docker

FROM node:20-bullseye-slim as builder
RUN mkdir /tmp/diceware
COPY . /tmp/diceware/
WORKDIR /tmp/diceware
RUN npm run build
FROM nginx:1.25-bullseye
COPY --from=builder /tmp/diceware/assets /usr/share/nginx/html/assets/
COPY --from=builder /tmp/diceware/dist /usr/share/nginx/html/dist/
COPY --from=builder /tmp/diceware/fonts /usr/share/nginx/html/fonts
COPY --from=builder /tmp/diceware/favicon.ico /usr/share/nginx/html/favicon.ico
COPY --from=builder /tmp/diceware/index.html /usr/share/nginx/html/index.html
COPY --from=builder /tmp/diceware/robots.txt /usr/share/nginx/html/robots.txt
RUN chmod -R a+rX /usr/share/nginx/html