Skip to content

Commit

Permalink
Add image version info (lloesche#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
lloesche authored Mar 20, 2021
1 parent c5f5a69 commit 0e02269
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,8 @@ jobs:
file: ./Dockerfile
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
build-args: |
COMMIT_TAG=${{ github.sha }}
tags: |
ghcr.io/lloesche/valheim-server:latest
ghcr.io/lloesche/valheim-server:${{ github.sha }}
build-args: SOURCE_COMMIT=${{ github.sha }}
tags: ghcr.io/lloesche/valheim-server:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM debian:stable-slim as build-env
ENV DEBIAN_FRONTEND=noninteractive
ARG TESTS
ARG SOURCE_COMMIT
RUN echo "${SOURCE_COMMIT:-unknown}" > /usr/local/etc/git-commit.HEAD
RUN apt-get update
RUN apt-get -y install apt-utils
RUN apt-get -y install build-essential curl git python3 python3-pip golang shellcheck
Expand Down
3 changes: 3 additions & 0 deletions common
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ cmd_valheim_status=/usr/local/bin/valheim-status
cmd_valheim_logfilter=/usr/local/bin/valheim-logfilter
cmd_supervisorctl=/usr/local/bin/supervisorctl

# File containing the git commit shasum this image was build with
git_commit_file=/usr/local/etc/git-commit.HEAD

# log levels
debug=50
info=40
Expand Down
2 changes: 2 additions & 0 deletions hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
docker build --build-arg SOURCE_COMMIT=$SOURCE_COMMIT -f $DOCKERFILE_PATH -t $IMAGE_NAME .
7 changes: 7 additions & 0 deletions valheim-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ if [ "$DEBUG_START_FRESH" = true ]; then
fi


# Output image commit version on startup
if [ -f "$git_commit_file" ]; then
commit=$(< "$git_commit_file")
debug "Running commit $commit"
fi


# Create paths
mkdir -p "$valheim_download_path"
mkdir -p "$valheim_install_path"
Expand Down

0 comments on commit 0e02269

Please sign in to comment.