Add production build dockerfile
This commit is contained in:
parent
363421a104
commit
b7d111866a
42
docker/prod-host/Dockerfile
Normal file
42
docker/prod-host/Dockerfile
Normal file
@ -0,0 +1,42 @@
|
||||
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/webfonts/ /code/static/webfonts/
|
||||
COPY themes/ /code/themes/
|
||||
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/
|
||||
43
docker/prod-host/nginx-server.conf
Normal file
43
docker/prod-host/nginx-server.conf
Normal file
@ -0,0 +1,43 @@
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
#access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
location / {
|
||||
root /var/www/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# proxy_pass http://127.0.0.1;
|
||||
#}
|
||||
|
||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# root html;
|
||||
# fastcgi_pass 127.0.0.1:9000;
|
||||
# fastcgi_index index.php;
|
||||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
||||
# include fastcgi_params;
|
||||
#}
|
||||
|
||||
# deny access to .htaccess files, if Apache's document root
|
||||
# concurs with nginx's one
|
||||
#
|
||||
#location ~ /\.ht {
|
||||
# deny all;
|
||||
#}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user