[CI] Building docker image and simple validation #2
Workflow file for this run
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: Docker image | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
env: | |
DOCKER_IMAGE_NAME: wkobiela/ammo_front | |
BUILD_TAG: PR-${{ github.event.number }} | |
jobs: | |
build: | |
name: Build Docker image | |
# Runner to use | |
runs-on: self-hosted | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --tag $DOCKER_IMAGE_NAME:$BUILD_TAG | |
- name: Run Docker container | |
run: docker run -d -p 3000:3000 $DOCKER_IMAGE_NAME:$BUILD_TAG | |
- 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 |