37 lines
765 B
Docker
37 lines
765 B
Docker
FROM alpine:3.17 AS builder
|
|
WORKDIR /app
|
|
|
|
COPY . .
|
|
RUN apk add --no-cache hugo && hugo --minify
|
|
|
|
FROM nginx:1.23-alpine AS runner
|
|
|
|
ARG NGINX_WORKER_PROCESSES=1
|
|
RUN sed -i -r \
|
|
"s/worker_processes\\s+auto/worker_processes $NGINX_WORKER_PROCESSES/" \
|
|
/etc/nginx/nginx.conf
|
|
|
|
RUN echo $'\
|
|
server {\
|
|
listen 80;\
|
|
listen [::]:80;\
|
|
server_name _;\
|
|
root /var/www/html;\
|
|
try_files $uri $uri/index.html @redirect;\
|
|
\
|
|
location ~ ^/(favicon.ico|robots.txt)$ {\
|
|
access_log off;\
|
|
}\
|
|
\
|
|
location ~ ^/(gpg.asc|ssh.keys)$ {\
|
|
add_header Content-Type text/plain;\
|
|
}\
|
|
\
|
|
location @redirect {\
|
|
return 301 $scheme://$http_host;\
|
|
}\
|
|
}\
|
|
' >/etc/nginx/conf.d/default.conf
|
|
|
|
COPY --from=builder /app/public /var/www/html
|