-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR adds an Alpine-based bare-bones Docker image with all required binaries. Closes #100
- Loading branch information
Showing
3 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FROM rust:alpine3.20 AS builder | ||
|
||
# Install pre-requisites | ||
RUN apk add build-base gcompat jemalloc-dev | ||
|
||
# Create a new directory for our application | ||
WORKDIR /tmp/quincy-build | ||
|
||
# Copy the source code into the container | ||
COPY src ./src | ||
COPY Cargo.toml Cargo.lock ./ | ||
|
||
# Build the application | ||
ARG FEATURES="crypto-standard,jemalloc" | ||
RUN cargo build --release --no-default-features --features "${FEATURES}" | ||
|
||
FROM alpine:3.20 | ||
|
||
# Create needed directories | ||
RUN mkdir -p /etc/quincy | ||
|
||
# Install glibc | ||
RUN apk add gcompat jemalloc libcap-setcap | ||
|
||
# Copy the binary from the builder stage | ||
COPY --from=builder /tmp/quincy-build/target/release/quincy-client /tmp/quincy-build/target/release/quincy-server /tmp/quincy-build/target/release/quincy-users /usr/local/bin/ | ||
|
||
# Add required capability to executable | ||
RUN setcap \ | ||
'cap_net_admin=+ep cap_net_bind_service=+ep' /usr/local/bin/quincy-client \ | ||
'cap_net_admin=+ep cap_net_bind_service=+ep' /usr/local/bin/quincy-server | ||
|
||
# Run under a non-root account | ||
RUN addgroup -S quincy && adduser -S quincy -G quincy | ||
USER quincy | ||
|
||
# Set the working directory | ||
WORKDIR /usr/srv/quincy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters