Skip to content

Commit

Permalink
Change actions
Browse files Browse the repository at this point in the history
  • Loading branch information
wkobiela committed Oct 29, 2024
1 parent b3092ad commit 96c3f7f
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions .github/workflows/build_docker.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Docker image
name: Docker

on:
push:
Expand All @@ -13,23 +13,39 @@ env:

jobs:
build:
name: Build Docker image
# Runner to use
name: Build image
runs-on: self-hosted

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Checkout
uses: actions/checkout@v4

- name: Build the Docker image
run: docker build . --file Dockerfile --tag $DOCKER_IMAGE_NAME:$BUILD_TAG

- name: Build and export to Docker
uses: docker/build-push-action@v6
with:
load: true
tags: $DOCKER_IMAGE_NAME:$BUILD_TAG

- name: Run Docker container
run: docker run -d -p 3000:3000 $DOCKER_IMAGE_NAME:$BUILD_TAG
run: docker run --name test -rm -d -p 3000:3000 $DOCKER_IMAGE_NAME:$BUILD_TAG

- name: Wait until the container is healthy
uses: raschmitt/wait-for-healthy-container/@master
with:
container-name: test
timeout: 120

- name: Verify if working
run: curl -f http://localhost:3000 || exit 1

- name: Remove the local image
run: docker rmi $DOCKER_IMAGE_NAME:$RELEASE_VERSION
- name: Remove container and local image
if: always()
run: |
docker rm --force test
docker rmi --force $DOCKER_IMAGE_NAME:$RELEASE_VERSION

0 comments on commit 96c3f7f

Please sign in to comment.