Skip to content

fix(build): move ARG declaration after FROM in Dockerfile#4772

Merged
kodiakhq[bot] merged 1 commit into
v2from
markphelps/dockerfile-arg-fix
Sep 30, 2025
Merged

fix(build): move ARG declaration after FROM in Dockerfile#4772
kodiakhq[bot] merged 1 commit into
v2from
markphelps/dockerfile-arg-fix

Conversation

@markphelps

Copy link
Copy Markdown
Collaborator

Summary

Fixes Docker build warning about undefined variable $BINARY by moving the ARG declaration to after the FROM instruction.

Changes

  • Modified build/Dockerfile: Moved ARG BINARY=flipt from before FROM alpine:3.22.1 to after it

Technical Details

ARG declarations before FROM are in global scope and cannot be used after FROM unless redeclared. This was causing the warning:

1 warning found (use docker --debug to expand):
- UndefinedVar: Usage of undefined variable '$BINARY' (line 14)

By moving the ARG declaration after FROM, it's properly scoped within the build stage and available for use in the COPY instruction.

Fixes #4584

Moved the BINARY ARG declaration from before the FROM instruction
to after it. ARG declarations before FROM are in global scope and
cannot be used after FROM unless redeclared, which was causing a
Docker build warning about undefined variable usage.

This change:
- Eliminates the UndefinedVar warning during docker build
- Properly scopes the ARG within the build stage
- Maintains build-time configurability with the default value

Fixes #4584

Signed-off-by: Mark Phelps <[email protected]>
@markphelps
markphelps requested a review from a team as a code owner September 30, 2025 20:18
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Sep 30, 2025
@dosubot

dosubot Bot commented Sep 30, 2025

Copy link
Copy Markdown

Related Documentation

Checked 3 published document(s). No updates required.

You have 3 draft document(s). Publish docs to keep them always up-to-date

How did I do? Any feedback?  Join Discord

@codecov

codecov Bot commented Sep 30, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.46%. Comparing base (b928b68) to head (351787c).
⚠️ Report is 1 commits behind head on v2.

Additional details and impacted files
@@            Coverage Diff             @@
##               v2    #4772      +/-   ##
==========================================
+ Coverage   58.42%   58.46%   +0.04%     
==========================================
  Files         134      134              
  Lines       16852    16852              
==========================================
+ Hits         9845     9852       +7     
+ Misses       6320     6314       -6     
+ Partials      687      686       -1     
Flag Coverage Δ
integrationtests 33.90% <ø> (+0.16%) ⬆️
unittests 49.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@markphelps markphelps added the automerge Used by Kodiak bot to automerge PRs label Sep 30, 2025
@kodiakhq
kodiakhq Bot merged commit 0488bfe into v2 Sep 30, 2025
42 of 44 checks passed
@kodiakhq
kodiakhq Bot deleted the markphelps/dockerfile-arg-fix branch September 30, 2025 20:36
@dosubot

dosubot Bot commented Sep 30, 2025

Copy link
Copy Markdown

Documentation Updates

Checked 3 published document(s). No updates required.

You have 3 draft document(s). Publish docs to keep them always up-to-date

How did I do? Any feedback?  Join Discord

ptejasvini pushed a commit to ptejasvini/flipt that referenced this pull request Oct 3, 2025
)

Moved the BINARY ARG declaration from before the FROM instruction
to after it. ARG declarations before FROM are in global scope and
cannot be used after FROM unless redeclared, which was causing a
Docker build warning about undefined variable usage.

This change:
- Eliminates the UndefinedVar warning during docker build
- Properly scopes the ARG within the build stage
- Maintains build-time configurability with the default value

Fixes flipt-io#4584

Signed-off-by: Mark Phelps <[email protected]>
Signed-off-by: tejasvini1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Used by Kodiak bot to automerge PRs size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build/Dockerfile defines ARG before FROM

2 participants