add bas #5
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
name: "[ DEV ]" | |
on: | |
push: | |
branches: [ "dev" ] | |
permissions: | |
packages: write | |
contents: read | |
jobs: | |
build-main: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
name: Checkout repository | |
- uses: pmorelli92/[email protected] | |
name: Build and Publish latest service image | |
with: | |
github-push-secret: ${{ secrets.GITHUB_TOKEN }} | |
docker-image-name: dockstatapi | |
docker-image-tag: dev # optional | |
dockerfile-path: Dockerfile # optional | |
build-context: . # optional | |
build-only: false # optional | |
- name: Run Docker container | |
run: | | |
set -e | |
docker pull ghcr.io/its4nik/dockstatapi:dev | |
docker run -d --name dockstatapi_test -p 8080:8080 ghcr.io/its4nik/dockstatapi:dev | |
sleep 30 # wait for the container to start | |
- name: Check if container is running | |
run: | | |
set -e | |
if ! docker ps | grep -q dockstatapi_test; then | |
echo "Error: Container is not running" | |
exit 1 | |
fi | |
- name: Check container logs | |
run: | | |
set -e | |
docker logs dockstatapi_test || true | |
- name: Cleanup | |
if: always() | |
run: | | |
docker stop dockstatapi_test || true | |
docker rm dockstatapi_test || true |