Update docker-image.yml #9
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: TestService Docker Image CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: [self-hosted, linux] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set Version Environment Variable | |
env: | |
VERSION: ${{ github.event_name == 'release' && github.ref == 'refs/tags/v*' && github.event.release.tag_name }} | |
run: | | |
# Use GitHub Actions context to set the VERSION environment variable. | |
if [ -n "$VERSION" ]; then | |
echo "Version is $VERSION" | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
fi | |
- name: Build and publish Docker image | |
run: | | |
# Build the Docker image with the package version tag. | |
docker build -t tschissler/testservice:${VERSION} -t tschissler/testservice:latest -f ./TestService/Dockerfile --push . | |
- name: Deploy to Kubernetes | |
run: microk8s kubectl apply -f /home/thomasschissler/SmartHome/deploy.yaml |