Added Docker image config
parent
8d07fe732c
commit
b1d1716fbd
|
@ -0,0 +1,15 @@
|
|||
# By default, ignore everything
|
||||
*
|
||||
|
||||
# Blog source
|
||||
!archetypes/
|
||||
!content/
|
||||
!data/
|
||||
!layouts/
|
||||
!resources/
|
||||
!static/
|
||||
!themes/
|
||||
!config.yaml
|
||||
|
||||
# Nginx config file
|
||||
!nginx.conf
|
|
@ -0,0 +1,18 @@
|
|||
FROM alpine:latest AS builder
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Install Hugo
|
||||
RUN apk add --no-cache hugo
|
||||
|
||||
# Copy site files for building
|
||||
COPY . ./
|
||||
|
||||
# Generate the site
|
||||
RUN hugo --minify
|
||||
|
||||
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
COPY --from=builder /usr/src/app/public /usr/share/nginx/html
|
|
@ -0,0 +1,26 @@
|
|||
worker_processes 1;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
# https://stackoverflow.com/a/51360290/6483444
|
||||
map $sent_http_content_type $expires {
|
||||
default off;
|
||||
text/html epoch;
|
||||
text/css max;
|
||||
application/javascript max;
|
||||
~image/ max;
|
||||
}
|
||||
|
||||
server {
|
||||
server_name _;
|
||||
listen 80;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
include mime.types;
|
||||
expires $expires;
|
||||
}
|
||||
}
|
Reference in New Issue