From bfde6c23f2d4ab8b8c3b28826611b45cf218c126 Mon Sep 17 00:00:00 2001 From: Elias Projahn Date: Sun, 23 Mar 2025 20:31:19 +0100 Subject: [PATCH] Create docker-ci.yml --- .github/workflows/docker-ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/docker-ci.yml diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml new file mode 100644 index 0000000..9a4b101 --- /dev/null +++ b/.github/workflows/docker-ci.yml @@ -0,0 +1,25 @@ +name: Docker Image CI +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Get short commit hash + run: echo "COMMIT_SHORT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + - name: Build the Docker image + run: docker build . --file Dockerfile --tag ubigen:$COMMIT_SHORT_HASH + - name: Run the container + run: docker run -dp 3464:3464 ubigen:$COMMIT_SHORT_HASH + - name: Test the application + run: | + for i in {1..10}; do + sleep 2 + echo "Try $i …" + curl -s http://localhost:3464 | grep -q "Ubigen" && echo "Success" && exit 0 + done + exit 1