Update Dockerfile #3
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: Build Jenkins swarm client container | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
CONTAINER_NAME: jenkins-swarm-client | |
jobs: | |
push: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build swarm image | |
run: | | |
docker build . \ | |
--build-arg JSWARM_UID=48435 \ | |
--build-arg JSWARM_GID=202 \ | |
--tag $CONTAINER_NAME \ | |
--label "runnumber=${GITHUB_RUN_ID}" | |
- name: Log in to GitHub Container Registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | |
- name: Push images | |
run: | | |
CONTAINER_ID=ghcr.io/${{ github.repository_owner }}/$CONTAINER_NAME | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
[ "$VERSION" == "master" ] && VERSION=latest | |
echo CONTAINER_ID=$CONTAINER_ID | |
echo VERSION=$VERSION | |
docker tag $CONTAINER_NAME $CONTAINER_ID:$VERSION | |
docker push $CONTAINER_ID:$VERSION |