Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(docker)resolve Dockerfile issue & fix CVEs #100

Merged
merged 7 commits into from
Nov 21, 2024
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
10 changes: 8 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ jobs:

docker_pipeline:
needs: ["lint_test"]
uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.7.0
uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.10.2
secrets: inherit
with:
publish: true
publish: true
docker_scan: true
permissions:
# required for all workflows
security-events: write
# required to fetch internal or private CodeQL packs
packages: read
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## Unreleased

* [#100](https://github.com/babylonlabs-io/vigilante/pull/100) bump docker workflow to 0.10.2,
fix some dockerfile issue

## v0.16.1

### Improvements
Expand Down
18 changes: 10 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

# Use muslc for static libs
ARG BUILD_TAGS="muslc"

# hadolint ignore=DL3018
RUN apk add --no-cache --update openssh git make build-base linux-headers libc-dev \
pkgconfig zeromq-dev musl-dev alpine-sdk libsodium-dev \
libzmq-static libsodium-static gcc
libzmq-static libsodium-static gcc && rm -rf /var/cache/apk/*

# Build
WORKDIR /go/src/github.com/babylonlabs-io/vigilante
Expand All @@ -27,26 +27,28 @@
fi

# Cosmwasm - Download correct libwasmvm version
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm/v2 | cut -d ' ' -f 2) && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \
-O /lib/libwasmvm_muslc.$(uname -m).a && \
wget -q https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \
-O /lib/libwasmvm_muslc."$(uname -m)".a && \
# verify checksum
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \
sha256sum /lib/libwasmvm_muslc.$(uname -m).a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$(uname -m) | cut -d ' ' -f 1)
wget -q https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \
sha256sum /lib/libwasmvm_muslc."$(uname -m)".a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc."$(uname -m)" | cut -d ' ' -f 1)

RUN CGO_LDFLAGS="$CGO_LDFLAGS -lstdc++ -lm -lsodium" \
CGO_ENABLED=1 \
BUILD_TAGS=$BUILD_TAGS \
LINK_STATICALLY=true \
make build

FROM alpine:3.16 AS run
FROM alpine:3.20 AS run
# Create a user
RUN addgroup --gid 1138 -S vigilante && adduser --uid 1138 -S vigilante -G vigilante
RUN apk add bash curl jq
# hadolint ignore=DL3018
RUN apk --no-cache add bash curl jq && rm -rf /var/cache/apk/*

# Label should match your github repo
LABEL org.opencontainers.image.source="https://github.com/babylonlabs-io/vigilante:${VERSION}"

Check warning on line 51 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker_pipeline / docker_build (linux/amd64, ubuntu-24.04)

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$VERSION' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 51 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker_pipeline / docker_build (linux/amd64, ubuntu-24.04)

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$VERSION' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 51 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker_pipeline / docker_build (linux/arm64, ubuntu-24.04-arm64)

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$VERSION' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 51 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker_pipeline / docker_build (linux/arm64, ubuntu-24.04-arm64)

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$VERSION' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

COPY --from=build-env /go/src/github.com/babylonlabs-io/vigilante/build/vigilante /bin/vigilante

Expand Down