-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile
50 lines (38 loc) · 1.2 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
43
44
45
46
47
48
49
50
FROM gsoci.azurecr.io/giantswarm/hugo:v0.139.3-full AS build
WORKDIR /docs
COPY . /docs
# Expose the release version in content
ENV HUGO_DOCS_VERSION="$CIRCLE_TAG"
RUN hugo \
--logLevel info \
--gc \
--minify \
--source src \
--printPathWarnings \
--printUnusedTemplates \
--destination /public \
--cleanDestinationDir
# Compress files using gzip
# (creates a copy and leaves the uncompressed version in place)
RUN find /public \
-type f -regextype posix-extended \
-iregex '.*\.(css|csv|html?|js|svg|txt|xml|json|webmanifest|ttf)' | \
xargs gzip -9 -k
# Remove uncompressed HTML files
# to reduce storage requirements and image size.
RUN find /public \
-type f \
-name 'index.html' \
-delete
FROM gsoci.azurecr.io/giantswarm/nginx:1.27-alpine
EXPOSE 8080
USER 0
# Delete default config (which we have no control over)
RUN rm -r /etc/nginx/conf.d && rm /etc/nginx/nginx.conf
COPY nginx.conf /etc/nginx/nginx.conf
# Ensure tmp dir exists and has right ownership
RUN mkdir -p /tmp/nginx && chown -R 101 /tmp/nginx
RUN nginx -t -c /etc/nginx/nginx.conf && \
rm -rf /tmp/nginx/nginx.pid
COPY --from=build --chown=101 /public /usr/share/nginx/html
USER 101