Personal_Website/docker/prod-host/Dockerfile

44 lines
1.1 KiB
Docker

ARG HUGO_ENV=production
ARG BASE_HOST=https://www.danieldecloet.nl/
FROM node:18 as node-builder
WORKDIR /code
COPY yarn.lock /code/yarn.lock
COPY package.json /code/package.json
RUN yarn --frozen-lockfile
COPY content/ /code/content/
COPY docker/prod-host/search-indexer.js /code/search-indexer.js
RUN node search-indexer.js
FROM alpine:3.16 as hugo-builder
WORKDIR /code
RUN apk add --no-cache hugo
COPY config.toml /code/config.toml
COPY static/robots.txt /code/static/robots.txt
COPY static/webfonts/ /code/static/webfonts/
COPY static/icons/ /code/static/icons/
COPY archetypes/ /code/archetypes/
COPY assets/ /code/assets/
COPY layouts/ /code/layouts/
COPY data/ /code/data/
COPY content/ /code/content/
COPY --from=node-builder /code/node_modules /code/node_modules
COPY --from=node-builder /code/static/js/lunr/PagesIndex.json /code/static/js/lunr/PagesIndex.json
RUN hugo -D --minify -b "$BASE_HOST"
FROM nginx:1.22.0-alpine
EXPOSE 80
COPY docker/prod-host/nginx-server.conf /etc/nginx/conf.d/default.conf
COPY --from=hugo-builder /code/public/ /var/www/html/