Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
echo ${{ toJSON(steps.sysdig.outputs.violation_report) }} | \
jq -r .
echo ${{ toJSON(steps.sysdig.outputs.violation_report) }} | \
jq -r .cis_docker_benchmark_violation_report[].violations[] | \
jq -r '.cis_docker_benchmark_violation_report[] | select(true) | .violations[]' | \
wc -l | \
xargs -I% test 0 -eq %

Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.20-alpine AS base

RUN set -eux \
&& apk --no-cache add ca-certificates \
&& apk --no-cache add --virtual build-dependencies cmake g++ make unzip curl git
&& apk --no-cache add --virtual build-dependencies cmake g++ make unzip curl git libcap

WORKDIR ${GOPATH}/src/github.com/AthenZ/garm

Expand Down Expand Up @@ -32,6 +32,9 @@ RUN BUILD_TIME=$(date -u +%Y%m%d-%H%M%S) \
go build -ldflags "-s -w -linkmode 'external' -extldflags '-static -fPIC -m64 -pthread -std=c++11 -lstdc++' -X 'main.Version=${APP_VERSION} at ${BUILD_TIME} by ${GO_VERSION}'" -a -tags "cgo netgo" -installsuffix "cgo netgo" -o "${APP_NAME}" \
&& mv "${APP_NAME}" "/usr/bin/${APP_NAME}"

# allow well-known port binding
RUN setcap 'cap_net_bind_service=+ep' "/usr/bin/${APP_NAME}"

RUN apk del build-dependencies --purge \
&& rm -rf "${GOPATH}"

Expand All @@ -50,7 +53,7 @@ COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /usr/bin/${APP_NAME} /go/bin/${APP_NAME}
# Copy user
COPY --from=builder /etc/passwd /etc/passwd
# USER ${APP_NAME}
USER ${APP_NAME}

HEALTHCHECK NONE
ENTRYPOINT ["/go/bin/garm"]