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
RUN apk add curl git
# download and unnzip the hugo binary then place it in /usr/local/bin
2022-02-23 22:09:56 +00:00
RUN curl -L https://github.com/gohugoio/hugo/releases/download/v0.92.2/hugo_0.92.2_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
# 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
# Tell the image to expose port 80 for HTTP
2021-12-08 22:25:02 +00:00
EXPOSE 80