+ New jobs for building both admin and normal docker images

+ New jobs for building both admin and normal binary packages

! NOTE: This commit is likely broken so do not use it to checkout
This commit is contained in:
shockrah 2022-03-27 00:45:07 -07:00
parent 9f78f316c5
commit ba0d75d383

View File

@ -4,6 +4,10 @@ stages:
- build-backend - build-backend
- deploy - deploy
include:
- local: 'ci/cargo.yml'
- local: 'ci/docker.yml'
pages: pages:
image: shockrah/website:latest image: shockrah/website:latest
stage: pages stage: pages
@ -22,62 +26,57 @@ pages:
paths: paths:
- public/ - public/
# Webpack bundles everything anyway so both admin/non-admin builds have
# the same frontend code.
build-frontend-js: build-frontend-js:
image: codesignal/typescript:v9.6.0 image: codesignal/typescript:v9.6.0
stage: build-frontend stage: build-frontend
stage: pages
only: only:
refs: refs:
- master - master
script: script:
- cd ts/ - cd ts/
- npm run setup - npm i
- npm run build - npm run build
artifacts: artifacts:
paths: paths:
- api/static/ - api/static/
# Literally both of these fail 99% of the time so I'm forgoing them completely build-server-no-admin:
# for now until I find something doesn't suck extends: .cargo-builder
# Builds out the intended zip package
build-server-binaries:
image: rustlang/rust:nightly
stage: build-backend
stage: pages
only:
refs:
- master
script: script:
- mkdir -p build
- cp api/templates/ api/static/ build/ -r
- cd api/ - cd api/
- cargo build --release - cargo build --release
- cd ../ - cd ../
- cp api/target/release/clippable-server build/server
- cp ./scripts/ build/ -r
- cp readme.md build/
- sh ./scripts/default-rocket-toml.sh
artifacts:
paths:
- build/
# Upload built docker image to the local registry build-server-admin-enabled:
deploy-docker-image: extends: .cargo-builder
stage: deploy script:
image: docker:stable - cd api/
only: - cargo build --release --features admin
refs: - cd ../
- master
needs: deploy-no-admin-docker:
- build-server-binaries stage: deploy
dependencies: extends: .docker-deploy
- build-server-binaries needs:
services: - build-server-no-admin
- docker:dind dependencies:
- build-server-no-admin
script: script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
- docker build -t registry.gitlab.com/shockrah/clippable . - docker build -t registry.gitlab.com/shockrah/clippable .
- docker push registry.gitlab.com/shockrah/clippable - docker push registry.gitlab.com/shockrah/clippable
deploy-admin-docker:
stage: deploy
extends: .docker-deploy
needs:
- build-server-admin-enabled
dependencies:
- build-server-admin-enabled
script:
- docker build -t registry.gitlab.com/shockrah/clippable:admin .
- docker push registry.gitlab.com/shockrah/clippable:admin