Skip to content

Commit 21eb967

Browse files
authored
Lint dockerfile (#543)
* Update Alpine image version * Consolidate RUN commands * Pin package versions * Add hadolint-action to lint Dockerfile on CI runs * Fix wording
1 parent d86f246 commit 21eb967

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

.github/workflows/test.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,21 @@ jobs:
6666
with:
6767
go-version: "1.22"
6868

69-
- name: Lint code issues 🚨
69+
- name: Lint code with golangci-lint 🚨
7070
uses: golangci/golangci-lint-action@v4
7171
with:
7272
version: "v1.57"
7373
skip-pkg-cache: true
7474
install-mode: "goinstall"
7575

76-
- name: Lint BASH script with shellcheck 🚨
76+
- name: Lint Bash script with shellcheck 🚨
7777
uses: ludeeus/action-shellcheck@master
7878

79+
- name: Lint Dockerfile with hadolint 🚨
80+
uses: hadolint/hadolint-action@v3.1.0
81+
with:
82+
dockerfile: Dockerfile
83+
7984
- name: Run Go tests 🔬
8085
run: go test -p 1 -cover -covermode atomic -coverprofile=profile.cov -v ./...
8186
env:

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# syntax=docker/dockerfile:1
22

33
# Use the official golang image to build the binary.
4-
FROM golang:1.22-alpine3.19 as builder
4+
FROM golang:1.22-alpine3.20 as builder
55

66
ARG TARGETOS
77
ARG TARGETARCH
@@ -10,12 +10,12 @@ ARG TARGETPLATFORM
1010
WORKDIR /gatewayd
1111
COPY . /gatewayd
1212

13-
RUN apk --no-cache add git make
14-
RUN mkdir -p dist
15-
RUN make build-platform GOOS=${TARGETOS} GOARCH=${TARGETARCH} OUTPUT_DIR=dist/${TARGETOS}-${TARGETARCH}
13+
RUN apk --no-cache add git=2.45.1-r0 make=4.4.1-r2 && \
14+
mkdir -p dist && \
15+
make build-platform GOOS=${TARGETOS} GOARCH=${TARGETARCH} OUTPUT_DIR=dist/${TARGETOS}-${TARGETARCH}
1616

1717
# Use alpine to create a minimal image to run the gatewayd binary.
18-
FROM alpine:3.19 as runner
18+
FROM alpine:3.20 as runner
1919

2020
ARG TARGETOS
2121
ARG TARGETARCH

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ services:
22
install_plugins:
33
# This intermediate service is used to install the plugins
44
# before starting the GatewayD service.
5-
image: alpine:3.18
5+
image: alpine:3.20
66
command: ["/bin/sh", "/setup.sh"]
77
volumes:
88
- ./setup.sh:/setup.sh:ro

0 commit comments

Comments
 (0)