2022-02-21 17:23:23 +00:00
|
|
|
variables:
|
|
|
|
REPO_NAME: codeberg.org/video-prize-ranch/rimgo
|
|
|
|
DOCKER_HOST: tcp://docker:2375
|
|
|
|
|
2022-05-14 15:47:28 +00:00
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
- deploy
|
|
|
|
|
2022-06-04 14:32:14 +00:00
|
|
|
bin:
|
|
|
|
stage: build
|
|
|
|
needs: []
|
|
|
|
image: golang:latest
|
|
|
|
script:
|
|
|
|
- mkdir -p $GOPATH/src/$(dirname $REPO_NAME)
|
|
|
|
- ln -svf $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME
|
|
|
|
- cd $GOPATH/src/$REPO_NAME
|
|
|
|
- CGO_ENABLED=0 go build -o $CI_PROJECT_DIR/rimgo
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- rimgo
|
|
|
|
|
2022-05-14 15:47:28 +00:00
|
|
|
docker:
|
2022-02-21 17:23:23 +00:00
|
|
|
image: docker:20
|
2022-05-14 15:47:28 +00:00
|
|
|
stage: build
|
2022-02-21 17:23:23 +00:00
|
|
|
services:
|
|
|
|
- name: docker:20-dind
|
|
|
|
command: ["--experimental"]
|
|
|
|
before_script:
|
|
|
|
- mkdir -p ~/.docker/cli-plugins
|
2022-03-22 22:29:23 +00:00
|
|
|
- wget -O ~/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.8.1/buildx-v0.8.1.linux-amd64
|
2022-02-21 17:23:23 +00:00
|
|
|
- chmod +x ~/.docker/cli-plugins/docker-buildx
|
|
|
|
script:
|
|
|
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
|
|
|
- docker context create mybuilder
|
|
|
|
- docker buildx create --use --name mybuilder mybuilder
|
2022-06-03 22:45:14 +00:00
|
|
|
- docker buildx build --platform linux/amd64,linux/arm64 --push -t $CI_REGISTRY_IMAGE:latest .
|
2022-05-14 15:47:28 +00:00
|
|
|
|
|
|
|
deploy:
|
|
|
|
image: alpine:latest
|
|
|
|
stage: deploy
|
|
|
|
needs: []
|
|
|
|
before_script:
|
|
|
|
- apk update && apk --no-cache add curl
|
|
|
|
- wget -O - https://fly.io/install.sh | sh
|
|
|
|
script:
|
2022-06-03 22:45:14 +00:00
|
|
|
- /root/.fly/bin/flyctl deploy --detach
|