Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhinav Gautam authored and Abhinav Gautam committed Oct 14, 2024
1 parent ee51dc0 commit ba6d122
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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

0 comments on commit ba6d122

Please sign in to comment.