38 lines
1008 B
Docker
38 lines
1008 B
Docker
# use the classic alpine image
|
|
FROM alpine as Builder
|
|
|
|
# install curl and git
|
|
RUN apk add --update curl git npm
|
|
|
|
# download and unnzip the hugo binary then place it in /usr/local/bin
|
|
RUN curl -L https://github.com/gohugoio/hugo/releases/download/v0.109.0/hugo_0.109.0_linux-arm64.tar.gz > hugo.tar.gz && tar -zxf hugo.tar.gz && mv hugo /usr/local/bin
|
|
|
|
# clone the blog repository as well as the theme submodule
|
|
RUN git clone --recurse-submodules https://gitlab.com/AHMZA/blog.git
|
|
|
|
# set blog (the folder we just cloned) as the current DIR
|
|
WORKDIR blog
|
|
|
|
# set tina_token
|
|
ARG TINA_TOKEN
|
|
|
|
# build Tina
|
|
RUN npm run tinacms build &&
|
|
|
|
# Hugo generates the static files and minifies them
|
|
RUN hugo --minify
|
|
|
|
|
|
|
|
# Nginx image is as basic as we can get
|
|
FROM nginx
|
|
|
|
# copy the nginx.conf file
|
|
COPY --from=Builder /blog/nginx.conf /etc/nginx/nginx.conf
|
|
|
|
# copy the static files
|
|
COPY --from=Builder /blog/public/ /usr/share/nginx/html
|
|
|
|
# Tell the image to expose port 80 for HTTP, SSL provided by reverse proxy.
|
|
EXPOSE 80
|