forked from JupiterBroadcasting/jupiterbroadcasting.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
18 lines (17 loc) · 849 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
FROM registry.gitlab.com/pages/hugo/hugo_extended:0.105.0 as builder
# this defaults to an empty variable
ARG BASE_URL
WORKDIR /site
COPY . /site
# when the argument is empty or PROD, do a normal production build
# else if it's TESTS_WEB use the specified baseURL "/", or
# exit 1, because that use case hasn't been provided
# https://explainshell.com/ is an awesome website which can explain this in more detail
# set -x : changes the shell's default verbosity and puts it in "debug" mode
RUN set -x && ( [ -z "${BASE_URL}" ] || [ "${BASE_URL}" == "PROD" ] ) \
&& hugo --gc \
|| ( [ "${BASE_URL}" == 'TESTS_WEB' ] && hugo --gc --baseURL "/" || exit 1 )
FROM nginx:alpine
RUN rm -rf /usr/share/nginx/html/*
RUN sed -i 's/#error_page/error_page/' /etc/nginx/conf.d/default.conf
COPY --from=builder /site/public /usr/share/nginx/html