mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 13:19:39 +02:00
Fix commit resolution for Docker builds
This commit is contained in:
parent
cf0e573533
commit
5b2fa3d707
3 changed files with 11 additions and 4 deletions
1
.github/workflows/publish.yml
vendored
1
.github/workflows/publish.yml
vendored
|
@ -82,3 +82,4 @@ jobs:
|
|||
provenance: false
|
||||
# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#adding-a-description-to-multi-arch-images
|
||||
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=A multi-arch Docker image for the Maybe Rails app
|
||||
build-args: BUILD_COMMIT_SHA=${{ github.sha }}
|
||||
|
|
|
@ -9,14 +9,16 @@ WORKDIR /rails
|
|||
|
||||
# Install base packages
|
||||
RUN apt-get update -qq && \
|
||||
apt-get install --no-install-recommends -y curl libvips postgresql-client git
|
||||
apt-get install --no-install-recommends -y curl libvips postgresql-client
|
||||
|
||||
# Set production environment
|
||||
ARG BUILD_COMMIT_SHA
|
||||
ENV RAILS_ENV="production" \
|
||||
BUNDLE_DEPLOYMENT="1" \
|
||||
BUNDLE_PATH="/usr/local/bundle" \
|
||||
BUNDLE_WITHOUT="development"
|
||||
|
||||
BUNDLE_WITHOUT="development" \
|
||||
BUILD_COMMIT_SHA=${BUILD_COMMIT_SHA}
|
||||
|
||||
# Throw-away build stage to reduce size of final image
|
||||
FROM base AS build
|
||||
|
||||
|
|
|
@ -5,7 +5,11 @@ module Maybe
|
|||
end
|
||||
|
||||
def commit_sha
|
||||
`git rev-parse HEAD`.chomp
|
||||
if Rails.env.production?
|
||||
ENV["BUILD_COMMIT_SHA"]
|
||||
else
|
||||
`git rev-parse HEAD`.chomp
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue