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

build: Use Debian base image instead of Alpine (#104) #180

Merged
merged 1 commit into from
Jul 3, 2024
Merged
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
20 changes: 10 additions & 10 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#============================================================================
# Builder Layer

# Use a slim Rust/Alpine image for build tooling.
FROM rust:1.79.0-alpine3.20 AS builder
# Use a slim Rust/Debian image for build tooling.
FROM rust:1.79.0-slim-bookworm AS builder

# Set the working directory.
WORKDIR /build
Expand All @@ -24,17 +24,17 @@ COPY Cargo.toml Cargo.lock ./
# -o pipefail: Pipelines return the status of the last command to exit
# with a non-zero status, or zero.
# 2) Setup the packages we'll need for our build:
# - musl-dev: Needed to build some C code we rely on.
# - build-essential: includes make, to build openssl
# - perl-base: perl is also needed to build openssl
# 3) Build Hipcheck in release configuration.
RUN set -eux -o pipefail; \
apk add --no-cache musl-dev; \
RUN set -eux; \
apt-get install -y build-essential perl-base; \
cargo build --release

#============================================================================
# App Layer

# Use an Alpine image so our final container is small.
FROM alpine:3.20 AS app
FROM debian:bookworm-slim AS app

# Set the working directory.
WORKDIR /app
Expand All @@ -44,7 +44,7 @@ WORKDIR /app
# 1) The Hipcheck binary.
# 2) The Hipcheck configuration.
# 3) The Hipcheck scripts.
COPY --from=builder /build/.target/release/hc ./hc
COPY --from=builder /build/target/release/hc ./hc
COPY config/ config/
COPY scripts/ scripts/

Expand All @@ -55,8 +55,8 @@ COPY scripts/ scripts/
# - npm: Used by Hipcheck to analyze JavaScript code.
# - git: Used by Hipcheck to collect repository data.
# 3) Add a user `hc_user` which will be set to run Hipcheck.
RUN set -eux -o pipefail; \
apk add --no-cache npm git; \
RUN set -eux; \
apt-get install -y npm git; \
npm install -g [email protected] --no-audit --no-fund; \
adduser --disabled-password hc_user && chown -R hc_user /app

Expand Down