From 96c0f677aaee414df5fce157a84324866f572bbe Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Sat, 7 Feb 2026 15:51:09 +0100 Subject: [PATCH] ffs --- .woodpecker.yml | 11 ++++------- Dockerfile | 7 +++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index de70f79..46dfb49 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,11 +1,4 @@ steps: - - - name: create-versioninfo - image: alpine - commands: - - 'echo "Commit SHA: ${CI_COMMIT_SHA:0:7}" > public/versioninfo' - - 'echo "Build Date: $(date -u +"%Y-%m-%d %H:%M:%S")" >> public/versioninfo' - - name: build-image # This plugin handles the DinD complexity for you image: woodpeckerci/plugin-docker-buildx @@ -24,3 +17,7 @@ steps: tags: - latest - ${CI_COMMIT_SHA:0:7} + # tell the Dockerfile about the commit SHA and build date + build_args: + - COMMIT_SHA=${CI_COMMIT_SHA:0:7} + - BUILD_DATE=$(date -u +"%Y-%m-%d %H:%M:%S") diff --git a/Dockerfile b/Dockerfile index d05b3c8..12df783 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,9 @@ # For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html +ARG COMMIT_SHA +ARG BUILD_DATE + # Make sure RUBY_VERSION matches the Ruby version in .ruby-version ARG RUBY_VERSION=3.2.4 FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base @@ -72,6 +75,10 @@ FROM base COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" COPY --from=build /rails /rails +# Add build information so we can check if the deployment works +RUN echo "Commit SHA: ${COMMIT_SHA}" > /app/public/versioninfo && \ + echo "Build Date: ${BUILD_DATE}" >> /app/public/versioninfo + # Run and own only the runtime files as a non-root user for security RUN groupadd --system --gid 1000 rails && \ useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \