forked from mathialm/secfit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |