More fixes
All checks were successful
docker

This commit is contained in:
ItzYanick 2023-03-24 13:34:44 +01:00
parent ec6a9f9440
commit 671b4be8fb
No known key found for this signature in database
GPG key ID: 0E3DB1F28A357B8A
2 changed files with 23 additions and 16 deletions

View file

@ -12,18 +12,25 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker Registry
uses: https://github.com/docker/login-action@v2
with:
registry: git.itzyanick.de
username: ItzYanick
password: ${{ secrets.PACKAGE_TOKEN }}
- name: Build and push
uses: https://github.com/docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: git.itzyanick.de/itzyanick/runner-docker:latest
build-args: |
CHECKOUT=${{ github.ref }}
- name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v2
- name: Log-in to Registry
run: echo "${{ secrets.PACKAGE_TOKEN }}" | docker login https://git.itzyanick.de -u ${{ github.actor }} --password-stdin
- name: Build and push container image
run: |
IMAGE_ID=$(echo git.itzyanick.de/${{ github.repository }} | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# when the branch is master, replace master with latest
[ "$VERSION" == "master" ] && VERSION=latest
CHECKOUT=$(echo "${{ github.ref }}" | sed 's|-.*||')
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
echo CHECKOUT=$CHECKOUT
# Build and Publish container image
docker buildx build --push \
--tag $IMAGE_ID:$VERSION \
--build-arg CHECKOUT=$CHECKOUT \
--platform linux/amd64 .

View file

@ -8,7 +8,7 @@ RUN apk fix && \
apk --no-cache --update add git make
RUN mkdir /build
RUN git clone https://git.itzyanick.de/ItzYanick/runner-docker.git /build/runner \
RUN git clone https://code.forgejo.org/forgejo/runner.git /build/runner \
&& cd /build/runner \
&& git checkout $CHECKOUT