From 1e76a1d444ee96f7fa9ec22c81599656d791c170 Mon Sep 17 00:00:00 2001 From: shockrah Date: Fri, 28 Jan 2022 13:57:35 -0800 Subject: [PATCH] + Build stage prior to image deployment stage --- .gitlab-ci.yml | 76 ++++++++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f8fd282..b43c94d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,39 +1,7 @@ stages: - - build - pages - -# Literally both of these fail 99% of the time so I'm forgoing them completely -# for now until I find something doesn't suck -# Builds out the intended zip package -#package: -# image: rustlang/rust:nightly -# stage: build -# script: -# - rustup default nightly-2021-09-18 -# - mkdir -p build -# - cp api/templates/ api/static/ build -r -# - cargo --version -# - cargo build --release -# - cp target/release/api build/server -# - cp ./scripts/generate-thumbnail.sh build/ -# - cp readme.md build/ -# - sh ./scripts/default-rocket-toml.sh -# artifacts: -# paths: -# - build/ - -# Build the updated docker -build-docker-image: - stage: build - image: docker:stable - services: - - docker:dind - script: - - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY" - - docker build -t registry.gitlab.com/shockrah/clippable . - - docker push registry.gitlab.com/shockrah/clippable - - + - build + - deploy pages: image: shockrah/website:latest @@ -49,3 +17,43 @@ pages: artifacts: paths: - public/ + +# Literally both of these fail 99% of the time so I'm forgoing them completely +# for now until I find something doesn't suck +# Builds out the intended zip package +package: + image: rustlang/rust:nightly + stage: build + script: + - rustup default nightly-2021-09-18 + - mkdir -p build + - cp api/templates/ api/static/ build -r + - cd api/ + - cargo build --release + - cd ../ + - cp api/target/release/api build/server + - cp ./scripts/ build/ -r + - cp readme.md build/ + - sh ./scripts/default-rocket-toml.sh + artifacts: + paths: + - build/ + +# Build the updated docker +build-docker-image: + stage: build + image: docker:stable + only: + refs: + - master + dependencies: + - package + services: + - docker:dind + script: + - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY" + - docker build -t registry.gitlab.com/shockrah/clippable . + - docker push registry.gitlab.com/shockrah/clippable + + +