-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (32 loc) · 1.14 KB
/
deploy-prod.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Build and Push Docker Image
on:
push:
branches:
- master
env:
DOCKER_REPO: puppet-master
DOCKER_IMAGE: prod
jobs:
build:
runs-on: ${{ vars.DOCKER_BUILD_RUNNER }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to Harbor
run: echo "${{ secrets.HARBOR_PASSWORD }}" | docker login https://harbor.internal.codebuckets.in -u '${{ secrets.HARBOR_USER }}' --password-stdin
- name: Build Docker image
run: docker build -t harbor.internal.codebuckets.in/${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:latest . -f Dockerfile
- name: Push Docker image
run: docker push harbor.internal.codebuckets.in/${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:latest
deploy:
runs-on: prod-server-hetzner
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Pull new Image
run: docker compose -f docker-compose.yml pull
- name: Remove old containers
run: docker compose -f docker-compose.yml down || true
- name: Start Container
run: docker compose -f docker-compose.yml up -d