Skip to content

Commit

Permalink
Add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 committed Sep 3, 2024
1 parent fc289f6 commit c4e3565
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/.dockerignore
.DS_Store
.git/
/.github/
/.gitignore
/.goreleaser.yml
/*.env*
/.golangci.yaml
/.vscode/
/target/
/CONTRIBUTING.md
/Dockerfile
/docs/
/LICENSE*
/Makefile.maker.yaml
/README.md
/shell.nix
/tarpaulin-report.html
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM rust:alpine3.20 AS builder

COPY Cargo.toml Cargo.lock /src/
RUN mkdir -p /src/src \
&& touch /src/src/main.rs \
&& cargo fetch --locked --manifest-path /src/Cargo.toml

ENV \
# TODO: uncomment when libgit2 is at least version 1.8.1
# LIBGIT2_NO_VENDOR=1 \
OPENSSL_NO_VENDOR=1 \
RUSTFLAGS='-C target-feature=-crt-static'
RUN apk add --no-cache --no-progress libgit2-dev musl-dev openssl-dev zlib-dev

COPY . /src/
RUN cargo install --locked --path /src --root /pkg \
&& strip /pkg/bin/pear-reviewer

################################################################################

FROM alpine:3.20

# upgrade all installed packages to fix potential CVEs in advance
# also remove apk package manager to hopefully remove dependency on OpenSSL 🤞
RUN apk upgrade --no-cache --no-progress \
&& apk add --no-cache --no-progress libgcc libgit2 openssl zlib \
&& apk del --no-cache --no-progress apk-tools alpine-keys

COPY --from=builder /pkg/bin/pear-reviewer /usr/bin/pear-reviewer
# make sure the binary can be executed
RUN pear-reviewer --version 2>/dev/null

ENTRYPOINT [ "/usr/bin/pear-reviewer" ]

0 comments on commit c4e3565

Please sign in to comment.