Skip to content

Commit

Permalink
Create docker-image-builder.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
amrevill authored and GitHub Enterprise committed Mar 19, 2025
1 parent 0d4ef6e commit a700642
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/docker-image-builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:
runs-on: [ self-hosted ]

steps:
- uses: actions/checkout@v4
# - name: Build the Docker image
# run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)

- name: Build Docker Image
run: |
docker build -t my-app:latest ./backend
# docker build -t my-app:latest .

# ✅ Stop & Remove Old Running Containers
- name: Stop & Remove Old Containers
run: |
docker stop my-app-container || true
docker rm my-app-container || true
# ✅ Run Docker Container with Latest Code
- name: Run Docker Container
run: |
docker run -d --name my-app-container -p 8080:8080 my-app:latest

0 comments on commit a700642

Please sign in to comment.