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
2023-11-10 23:24:28 +00:00
RUN curl -L https://github.com/gohugoio/hugo/releases/download/v0.120.3/hugo_0.120.3_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-16 16:36:44 +00:00
# set tina_cid & tina_token
2023-11-16 16:43:57 +00:00
ENV TINA_TOKEN
ENV TINA_CID
2023-11-10 21:18:01 +00:00
2023-11-10 22:52:56 +00:00
RUN npm install @tinacms/cli
2023-11-10 22:49:08 +00:00
2023-11-10 21:32:12 +00:00
# build Tina and generate minifed hugo files
2023-11-10 23:26:13 +00:00
RUN npx @tinacms/cli@latest build && 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