2022-05-30 18:38:51 +01:00
# use the classic alpine image
2022-02-23 22:09:56 +00:00
FROM alpine as Builder
2022-05-30 18:38:51 +01:00
# install curl and git
2023-11-10 21:18:01 +00:00
RUN apk add --update curl git npm
2022-05-30 18:38:51 +01:00
# download and unnzip the hugo binary then place it in /usr/local/bin
2022-12-29 11:19:28 +00:00
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
2022-05-30 18:38:51 +01:00
# clone the blog repository as well as the theme submodule
2022-02-23 22:09:56 +00:00
RUN git clone --recurse-submodules https://gitlab.com/AHMZA/blog.git
2022-05-30 18:38:51 +01:00
# set blog (the folder we just cloned) as the current DIR
2022-02-23 22:09:56 +00:00
WORKDIR blog
2022-05-30 18:38:51 +01:00
2023-11-10 21:18:01 +00:00
# set tina_token
ARG TINA_TOKEN
2023-11-10 21:20:15 +00:00
RUN echo $TINA_TOKEN
2023-11-10 21:18:01 +00:00
# build Tina
RUN npm run tinacms build &&
2022-05-30 18:38:51 +01:00
# Hugo generates the static files and minifies them
2022-02-23 22:09:56 +00:00
RUN hugo --minify
2022-05-30 18:38:51 +01:00
# Nginx image is as basic as we can get
2021-12-09 00:03:53 +00:00
FROM nginx
2022-05-30 18:38:51 +01:00
# copy the nginx.conf file
2022-02-23 22:09:56 +00:00
COPY --from= Builder /blog/nginx.conf /etc/nginx/nginx.conf
2022-05-30 18:38:51 +01:00
# copy the static files
2022-02-23 22:09:56 +00:00
COPY --from= Builder /blog/public/ /usr/share/nginx/html
2022-05-30 18:38:51 +01:00
2023-06-21 15:31:02 +01:00
# Tell the image to expose port 80 for HTTP, SSL provided by reverse proxy.
2021-12-08 22:25:02 +00:00
EXPOSE 80