Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.PUBLIC_DOCKER_USERNAME }}
password: ${{ secrets.PUBLIC_DOCKER_PASSWORD }}

- name: Get Build Info
id: build_info
run: |
Expand All @@ -42,21 +36,26 @@ jobs:
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
IMAGE_TAG="${GITHUB_REF#refs/tags/}"
echo "tags=razorpay/ifsc:${IMAGE_TAG},razorpay/ifsc:latest" >> $GITHUB_OUTPUT
echo "custom_tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT
else
# Use the trigger SHA instead of the merge commit SHA
IMAGE_TAG="${{ steps.build_info.outputs.trigger_sha }}"
echo "tags=razorpay/ifsc:${IMAGE_TAG}" >> $GITHUB_OUTPUT
echo "custom_tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT
fi

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.PUBLIC_DOCKER_USERNAME }}
password: ${{ secrets.PUBLIC_DOCKER_PASSWORD }}

- name: Build & Push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.vars.outputs.tags }}
# No special network configuration or REDIS_HOST arguments are needed.
tags: razorpay/ifsc:${{ steps.vars.outputs.custom_tag }}
build-args: |
VERSION=${{ github.ref_name }}
COMMIT=${{ steps.build_info.outputs.trigger_sha }}
Expand Down
19 changes: 11 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 ruby:3.1-alpine3.18 AS rdbbuilder

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

# Set the working directory
WORKDIR /app
Expand All @@ -10,18 +10,21 @@
BUNDLE_GEMFILE="Gemfile.build"
ENV PATH="/app/vendor/bundle/bin:$PATH"

# Copy build-specific files
COPY Gemfile.build* init.rb /app/
COPY data /app/data/

# Layer 1: Install OS dependencies and the correct Bundler version.
RUN echo "** Builder: Installing OS and Bundler dependencies... **" && \
apk --no-cache add redis && \
RUN apk --no-cache add redis && \
gem install bundler -v 2.4.10

# Copy dependency files only (cached unless Gemfile.build changes)
COPY Gemfile.build* /app/

# Layer 2: Install the application's gems.
RUN echo "** Builder: Installing gems... **" && \
bundle install --jobs=$(nproc) --retry 3
RUN bundle install --jobs=$(nproc) --retry 3

## Don't change the above lines since these lines are cached with cache image

# Copy build script and data files (cache-busting boundary)
COPY init.rb /app/
COPY data /app/data/

# Layer 3: Run the database seeding script.
RUN echo "** Builder: Starting redis-server in the background... **" && \
Expand Down