trying a different method of building
This commit is contained in:
+6
-30
@@ -3,37 +3,13 @@ stages:
|
|||||||
- dockerize
|
- dockerize
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
CONTAINER_IMAGE: registry.gitlab.com/ahmza/blog:latest
|
TAG_LATEST: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:latest
|
||||||
GIT_SUBMODULE_STRATEGY: recursive
|
TAG_COMMIT: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA
|
||||||
|
|
||||||
Build:
|
Build:
|
||||||
stage: build
|
stage: build
|
||||||
image: alpine:latest
|
image: docker:latest
|
||||||
before_script:
|
services:
|
||||||
- which curl || ( apk update && apk add curl )
|
- docker:dind
|
||||||
- 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
|
|
||||||
script:
|
script:
|
||||||
- hugo
|
- docker build -t $TAG_COMMIT -t $TAG_LATEST .
|
||||||
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
|
|
||||||
|
|||||||
+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
|
FROM nginx
|
||||||
WORKDIR /usr/share/nginx/html
|
COPY --from=Builder /blog/nginx.conf /etc/nginx/nginx.conf
|
||||||
RUN rm -r /usr/share/nginx/html/index.html
|
COPY --from=Builder /blog/public/ /usr/share/nginx/html
|
||||||
COPY ./public /usr/share/nginx/html
|
|
||||||
RUN ls
|
|
||||||
RUN cat index.html
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|||||||
Reference in New Issue
Block a user