trying a different method of building
This commit is contained in:
+6
-30
@@ -3,37 +3,13 @@ stages:
|
||||
- dockerize
|
||||
|
||||
variables:
|
||||
CONTAINER_IMAGE: registry.gitlab.com/ahmza/blog:latest
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
TAG_LATEST: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:latest
|
||||
TAG_COMMIT: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA
|
||||
|
||||
Build:
|
||||
stage: build
|
||||
image: alpine:latest
|
||||
before_script:
|
||||
- which curl || ( apk update && apk add curl )
|
||||
- curl -L https://github.com/gohugoio/hugo/releases/download/v0.90.0/hugo_0.90.0_Linux-64bit.tar.gz > hugo.tar.gz
|
||||
- tar -zxf hugo.tar.gz
|
||||
- mv hugo /usr/local/bin
|
||||
image: docker:latest
|
||||
services:
|
||||
- docker:dind
|
||||
script:
|
||||
- hugo
|
||||
artifacts:
|
||||
name: "webfiles"
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- main
|
||||
|
||||
|
||||
Dockerize:
|
||||
stage: dockerize
|
||||
image:
|
||||
name: nginx:latest
|
||||
script:
|
||||
- mv nginx.conf /etc/nginx/nginx.conf
|
||||
- cd public
|
||||
- mv * /usr/share/nginx/html
|
||||
- ls /etc/nginx/
|
||||
- cat /etc/nginx/nginx.conf
|
||||
- ls /usr/share/nginx/html
|
||||
only:
|
||||
- main
|
||||
- docker build -t $TAG_COMMIT -t $TAG_LATEST .
|
||||
|
||||
+9
-5
@@ -1,7 +1,11 @@
|
||||
FROM alpine as Builder
|
||||
RUN apk update && apk add curl git
|
||||
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
|
||||
RUN git clone --recurse-submodules https://gitlab.com/AHMZA/blog.git
|
||||
WORKDIR blog
|
||||
RUN hugo --minify
|
||||
|
||||
FROM nginx
|
||||
WORKDIR /usr/share/nginx/html
|
||||
RUN rm -r /usr/share/nginx/html/index.html
|
||||
COPY ./public /usr/share/nginx/html
|
||||
RUN ls
|
||||
RUN cat index.html
|
||||
COPY --from=Builder /blog/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY --from=Builder /blog/public/ /usr/share/nginx/html
|
||||
EXPOSE 80
|
||||
|
||||
Reference in New Issue
Block a user