-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (30 loc) · 1.23 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# This is a multi-stage Dockerfile (build and run)
# Remember to target specific version in your base image,
# because you want reproducibility (in a few years you will thank me)
# FROM alpine:3.10 AS build
# # The Hugo version
# ARG VERSION=0.60.1
# ADD https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_${VERSION}_Linux-64bit.tar.gz /hugo.tar.gz
# RUN tar -zxvf hugo.tar.gz
# RUN /hugo version
# # The source files are copied to /site
# COPY . /site
# WORKDIR /site
# # And then we just run Hugo
# RUN /hugo --minify
# # stage 2
FROM nginx:1.15-alpine
LABEL maintainer="Fabian Peter <[email protected]>"
ARG BUILD_DATE
WORKDIR /usr/share/nginx/html/
# Clean the default public folder
RUN rm -fr * .??*
# This inserts a line in the default config file, including our file "expires.inc"
RUN sed -i '9i\ include /etc/nginx/conf.d/expires.inc;\n' /etc/nginx/conf.d/default.conf
# The file "expires.inc" is copied into the image
COPY ci/expires.inc /etc/nginx/conf.d/expires.inc
RUN chmod 0644 /etc/nginx/conf.d/expires.inc
# Finally, the "public" folder generated by Hugo in the previous stage
# is copied into the public fold of nginx
LABEL org.label-schema.build-date=$BUILD_DATE
COPY ./public /usr/share/nginx/html