Skip to content

Commit

Permalink
CI: Update dockerfile to use a multi-stage build.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbloodsworth committed Feb 13, 2025
1 parent ba09208 commit adac35c
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
### Building and installation
# ---- Build Stage ----
FROM rust:1-bullseye AS builder

# Build and runtime dependencies (split into two stages later?)
# Install build dependencies
RUN apt-get update \
&& apt-get -y install libsqlite3-dev \
&& rm /var/lib/apt/lists/* -fr
&& rm -rf /var/lib/apt/lists/*

# Install leekbot
# Set up workspace
WORKDIR /usr/src/leekbot
COPY . .
RUN cargo install --path .

CMD ["/usr/local/cargo/bin/leekbot"]
# Build the leekbot binary
RUN cargo install --path . --root /usr/local

# ---- Runtime Stage ----
FROM debian:bullseye-slim AS runtime

# Install runtime dependencies
RUN apt-get update \
&& apt-get -y install libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*

# Copy the built binary from the builder stage
COPY --from=builder /usr/local/bin/leekbot /usr/local/bin/leekbot

# Set the entrypoint
CMD ["/usr/local/bin/leekbot"]

0 comments on commit adac35c

Please sign in to comment.