Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ jobs:
push: true
platforms: linux/amd64,linux/arm64
tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.app.name }}:${{ inputs.image-tag }}
cache-from: type=gha,scope=${{ matrix.app.name }}
cache-to: type=gha,mode=max,scope=${{ matrix.app.name }}
3 changes: 3 additions & 0 deletions .github/workflows/docker-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
uses: actions/setup-go@v6.3.0
with:
go-version-file: ./test/docker-e2e/go.mod
cache-dependency-path: "**/go.sum"
- name: Install just
uses: extractions/setup-just@v3
- name: Run Docker E2E Tests
Expand All @@ -46,6 +47,7 @@ jobs:
uses: actions/setup-go@v6.3.0
with:
go-version-file: ./test/docker-e2e/go.mod
cache-dependency-path: "**/go.sum"
- name: Install just
uses: extractions/setup-just@v3
- name: Run Docker Upgrade E2E Tests
Expand All @@ -65,6 +67,7 @@ jobs:
uses: actions/setup-go@v6.3.0
with:
go-version-file: ./test/docker-e2e/go.mod
cache-dependency-path: "**/go.sum"
- name: Install just
uses: extractions/setup-just@v3
- name: Run Docker Compat E2E Tests
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- uses: actions/setup-go@v6.3.0
with:
go-version-file: ./go.mod
cache-dependency-path: "**/go.sum"
# This steps sets the GIT_DIFF environment variable to true
# if files defined in PATTERS changed
- uses: technote-space/get-diff-action@v6.1.2
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
uses: actions/setup-go@v6.3.0
with:
go-version-file: ./go.mod
cache-dependency-path: "**/go.sum"
- name: Install just
uses: extractions/setup-just@v3
- name: Build all ev-node binaries
Expand All @@ -30,6 +31,7 @@ jobs:
- uses: actions/setup-go@v6.3.0
with:
go-version-file: ./go.mod
cache-dependency-path: "**/go.sum"
- uses: extractions/setup-just@v3
- run: just deps
- name: check for diff
Expand All @@ -47,6 +49,7 @@ jobs:
uses: actions/setup-go@v6.3.0
with:
go-version-file: ./go.mod
cache-dependency-path: "**/go.sum"
- name: Install just
uses: extractions/setup-just@v3
- name: Run unit test
Expand All @@ -66,6 +69,7 @@ jobs:
uses: actions/setup-go@v6.3.0
with:
go-version-file: ./go.mod
cache-dependency-path: "**/go.sum"
- name: Install just
uses: extractions/setup-just@v3
- name: Run integration test
Expand All @@ -89,6 +93,7 @@ jobs:
uses: actions/setup-go@v6.3.0
with:
go-version-file: ./go.mod
cache-dependency-path: "**/go.sum"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build evstack:local-dev (cached)
Expand All @@ -98,8 +103,8 @@ jobs:
file: apps/testapp/Dockerfile
load: true
tags: evstack:local-dev
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=gha,scope=ev-node-testapp
cache-to: type=gha,mode=max,scope=ev-node-testapp
- name: Install just
uses: extractions/setup-just@v3
- name: E2E Tests
Expand All @@ -115,6 +120,7 @@ jobs:
uses: actions/setup-go@v6.3.0
with:
go-version-file: ./go.mod
cache-dependency-path: "**/go.sum"
- name: Install just
uses: extractions/setup-just@v3
- name: EVM Tests
Expand Down
12 changes: 9 additions & 3 deletions apps/testapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM golang:1.25 AS base

#hadolint ignore=DL3018
RUN apt-get update && \

Check failure on line 4 in apps/testapp/Dockerfile

View workflow job for this annotation

GitHub Actions / lint / hadolint

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
Expand All @@ -17,11 +17,17 @@

WORKDIR /ev-node

# Copy all source code first
# Copy module files first to leverage Docker layer caching.
# Dependencies are only re-downloaded when go.mod or go.sum change.
COPY go.mod go.sum ./
COPY apps/testapp/go.mod apps/testapp/go.sum ./apps/testapp/
RUN go mod download && (cd apps/testapp && go mod download)

Check failure on line 24 in apps/testapp/Dockerfile

View workflow job for this annotation

GitHub Actions / lint / hadolint

DL3003 warning: Use WORKDIR to switch to a directory
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix hadolint DL3003: use WORKDIR instead of cd in subshell.

The CI lint check is failing because (cd apps/testapp && go mod download) violates DL3003. Refactor to use WORKDIR directives to satisfy the linter.

Suggested fix
 COPY go.mod go.sum ./
 COPY apps/testapp/go.mod apps/testapp/go.sum ./apps/testapp/
-RUN go mod download && (cd apps/testapp && go mod download)
+RUN go mod download
+
+WORKDIR /ev-node/apps/testapp
+RUN go mod download
+
+WORKDIR /ev-node
 
 # Copy the rest of the source and build.
 COPY . .
 
-WORKDIR /ev-node/apps/testapp
+WORKDIR /ev-node/apps/testapp
 RUN go build -o /go/bin/testapp .

Alternatively, if you want to minimize layer count, you could use a single multi-line RUN with explicit WORKDIR reset, but splitting into separate RUN commands is cleaner and still benefits from caching since the layer depends only on the module files.

🧰 Tools
🪛 GitHub Check: lint / hadolint

[failure] 24-24:
DL3003 warning: Use WORKDIR to switch to a directory

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/testapp/Dockerfile` at line 24, The RUN line uses a subshell with cd
(RUN go mod download && (cd apps/testapp && go mod download)) which triggers
hadolint DL3003; replace the subshell by switching WORKDIR to apps/testapp
before running its go mod download and then reset WORKDIR (or use a second RUN)
so you run go mod download in the project directory without cd; update the
Dockerfile to add a WORKDIR apps/testapp + RUN go mod download (and then WORKDIR
back to original if needed) or split into two RUNs, referencing the existing RUN
command and the apps/testapp path to locate where to change.


# Copy the rest of the source and build.
COPY . .

# Now download dependencies and build
RUN go mod download && cd apps/testapp && go install .
WORKDIR /ev-node/apps/testapp
RUN go build -o /go/bin/testapp .

## prep the final image.
#
Expand Down
Loading