docker: pass in build-args, add $NOW
This commit is contained in:
parent
2eb17a1419
commit
8a010dbcc7
3 changed files with 21 additions and 6 deletions
12
.github/workflows/docker.yml
vendored
12
.github/workflows/docker.yml
vendored
|
|
@ -20,6 +20,11 @@ jobs:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
-
|
||||||
|
name: Set environment variables
|
||||||
|
run: |
|
||||||
|
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||||
|
echo "NOW=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
@ -29,6 +34,7 @@ jobs:
|
||||||
-
|
-
|
||||||
name: Login to Docker Hub
|
name: Login to Docker Hub
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
|
if: ${{ secrets.DOCKERHUB_USERNAME && secrets.DOCKERHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
@ -44,8 +50,12 @@ jobs:
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64 # ,linux/arm/v7
|
|
||||||
push: true
|
push: true
|
||||||
|
build-args: |
|
||||||
|
COMMIT=${{ github.sha }}
|
||||||
|
BRANCH=${{ env.BRANCH }}
|
||||||
|
NOW=${{ env.NOW }}
|
||||||
|
platforms: linux/amd64,linux/arm64 # ,linux/arm/v7
|
||||||
tags: |
|
tags: |
|
||||||
voglerr/free-games-claimer:latest
|
voglerr/free-games-claimer:latest
|
||||||
ghcr.io/vogler/free-games-claimer:latest
|
ghcr.io/vogler/free-games-claimer:latest
|
||||||
|
|
|
||||||
12
Dockerfile
12
Dockerfile
|
|
@ -60,19 +60,23 @@ COPY . .
|
||||||
RUN dos2unix *.sh && chmod +x *.sh
|
RUN dos2unix *.sh && chmod +x *.sh
|
||||||
COPY docker-entrypoint.sh /usr/local/bin/
|
COPY docker-entrypoint.sh /usr/local/bin/
|
||||||
|
|
||||||
|
ARG COMMIT=""
|
||||||
|
ARG BRANCH=""
|
||||||
|
ARG NOW=""
|
||||||
|
ENV COMMIT=${COMMIT}
|
||||||
|
ENV BRANCH=${BRANCH}
|
||||||
|
ENV NOW=${NOW}
|
||||||
|
|
||||||
LABEL org.opencontainers.image.title="free-games-claimer" \
|
LABEL org.opencontainers.image.title="free-games-claimer" \
|
||||||
org.opencontainers.image.name="free-games-claimer" \
|
org.opencontainers.image.name="free-games-claimer" \
|
||||||
org.opencontainers.image.description="Automatically claims free games on the Epic Games Store, Amazon Prime Gaming and GOG" \
|
org.opencontainers.image.description="Automatically claims free games on the Epic Games Store, Amazon Prime Gaming and GOG" \
|
||||||
org.opencontainers.image.url="https://github.com/vogler/free-games-claimer" \
|
org.opencontainers.image.url="https://github.com/vogler/free-games-claimer" \
|
||||||
org.opencontainers.image.source="https://github.com/vogler/free-games-claimer" \
|
org.opencontainers.image.source="https://github.com/vogler/free-games-claimer" \
|
||||||
org.opencontainers.image.revision=${COMMIT_SHA} \
|
org.opencontainers.image.revision=${COMMIT} \
|
||||||
org.opencontainers.image.ref.name=${BRANCH} \
|
org.opencontainers.image.ref.name=${BRANCH} \
|
||||||
org.opencontainers.image.base.name="ubuntu:jammy" \
|
org.opencontainers.image.base.name="ubuntu:jammy" \
|
||||||
org.opencontainers.image.version="latest"
|
org.opencontainers.image.version="latest"
|
||||||
|
|
||||||
ENV COMMIT_SHA=${COMMIT_SHA}
|
|
||||||
ENV BRANCH=${BRANCH}
|
|
||||||
|
|
||||||
# Configure VNC via environment variables:
|
# Configure VNC via environment variables:
|
||||||
ENV VNC_PORT 5900
|
ENV VNC_PORT 5900
|
||||||
ENV NOVNC_PORT 6080
|
ENV NOVNC_PORT 6080
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,9 @@
|
||||||
|
|
||||||
set -eo pipefail # exit on error, error on any fail in pipe (not just last cmd); add -x to print each cmd; see gist bash_strict_mode.md
|
set -eo pipefail # exit on error, error on any fail in pipe (not just last cmd); add -x to print each cmd; see gist bash_strict_mode.md
|
||||||
|
|
||||||
echo "Version: https://github.com/vogler/free-games-claimer/tree/${COMMIT_SHA}"
|
echo "Version: https://github.com/vogler/free-games-claimer/tree/${COMMIT}"
|
||||||
[ ! -z $BRANCH ] && [ $BRANCH != "main" ] && echo "Branch: ${BRANCH}"
|
[ ! -z $BRANCH ] && [ $BRANCH != "main" ] && echo "Branch: ${BRANCH}"
|
||||||
|
echo "Build: $NOW"
|
||||||
|
|
||||||
# Remove chromium profile lock.
|
# Remove chromium profile lock.
|
||||||
# When running in docker and then killing it, on the next run chromium displayed a dialog to unlock the profile which made the script time out.
|
# When running in docker and then killing it, on the next run chromium displayed a dialog to unlock the profile which made the script time out.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue