Initial commit: Erika CV site with Nomad deployment
Some checks failed
Build and Deploy Erika CV / build-and-deploy (push) Failing after 10s
Some checks failed
Build and Deploy Erika CV / build-and-deploy (push) Failing after 10s
This commit is contained in:
96
.gitea/workflows/deploy.yml
Normal file
96
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,96 @@
|
||||
name: Build and Deploy Erika CV
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: debian-host
|
||||
|
||||
env:
|
||||
PATH: /usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/bin:/snap/bin
|
||||
DOCKER_HOST: unix:///var/run/docker.sock
|
||||
BUILDX_CONFIG: /tmp/buildx
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: System info
|
||||
run: |
|
||||
uname -a
|
||||
whoami
|
||||
|
||||
- name: Set up Docker Context for Buildx
|
||||
id: buildx-context
|
||||
run: |
|
||||
export DOCKER_HOST=tcp://docker:2376/
|
||||
export DOCKER_TLS_VERIFY=0
|
||||
docker context rm builders || true
|
||||
docker context create builders
|
||||
|
||||
- name: Verify Docker
|
||||
run: docker --version
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
env:
|
||||
PATH: /usr/bin:/usr/local/bin:/bin:/sbin:/usr/sbin
|
||||
|
||||
- name: Log in to Harbor Registry
|
||||
run: |
|
||||
echo "${{ secrets.HARBOR_ROBOT_TOKEN }}" | docker login registry.i80.dk -u "robot\$gitserver" --password-stdin
|
||||
env:
|
||||
PATH: /usr/bin:/usr/local/bin:/bin:/sbin:/usr/sbin
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
env:
|
||||
PATH: /usr/bin:/usr/local/bin:/bin:/sbin:/usr/sbin
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
registry.i80.dk/gitea/web-erika:latest
|
||||
registry.i80.dk/gitea/web-erika:${{ github.sha }}
|
||||
build-args: |
|
||||
BUILD_VERSION=${{ github.ref_name }}-${{ github.sha }}
|
||||
GIT_COMMIT=${{ github.sha }}
|
||||
BUILD_TIME=${{ github.event.head_commit.timestamp }}
|
||||
|
||||
- name: Validate Nomad job
|
||||
run: |
|
||||
echo "Validating Nomad job..."
|
||||
nomad job validate erika.nomad
|
||||
env:
|
||||
NOMAD_ADDR: "https://nomad.i80.dk:4646"
|
||||
|
||||
- name: Deploy to Nomad
|
||||
run: |
|
||||
echo "Deploying to Nomad..."
|
||||
nomad job run erika.nomad
|
||||
env:
|
||||
NOMAD_ADDR: "https://nomad.i80.dk:4646"
|
||||
|
||||
- name: Wait for deployment
|
||||
run: |
|
||||
sleep 10
|
||||
nomad job status web-erika
|
||||
nomad job allocs web-erika
|
||||
env:
|
||||
NOMAD_ADDR: "https://nomad.i80.dk:4646"
|
||||
|
||||
- name: Health check
|
||||
run: |
|
||||
sleep 20
|
||||
curl -f https://erika.i80.dk/health || echo "Not yet available"
|
||||
|
||||
- name: Notify deployment status
|
||||
run: |
|
||||
echo "Deployment complete"
|
||||
echo "Site: https://erika.i80.dk"
|
||||
echo "Health: https://erika.i80.dk/health"
|
||||
Reference in New Issue
Block a user