Skip to content

Commit 84ee9d7

Browse files
fao89claude
andcommitted
Optimize Dockerfile for smaller image size and security
Updates Dockerfile to use slim base images, multi-stage build optimization, and improved package management for reduced attack surface. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b56f1e0 commit 84ee9d7

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

Dockerfile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1-
FROM rust:latest as build
1+
FROM rust:1.82-slim AS build
2+
3+
RUN apt-get update && apt-get install -y \
4+
pkg-config \
5+
libssl-dev \
6+
libpq-dev \
7+
&& rm -rf /var/lib/apt/lists/*
28

39
COPY . .
410

511
RUN cargo build --release
612

7-
FROM ubuntu:latest
13+
FROM debian:12-slim
14+
15+
RUN apt-get update && apt-get install -y \
16+
libpq5 \
17+
ca-certificates \
18+
&& rm -rf /var/lib/apt/lists/*
19+
COPY --from=build /target/release/groot /groot
820

9-
ENV DEBIAN_FRONTEND=noninteractive
10-
RUN apt-get -y update && \
11-
apt-get -y upgrade && \
12-
apt -y install ca-certificates libssl-dev libpq-dev
21+
EXPOSE 3030
1322

14-
COPY --from=build /target/release/groot /usr/local/bin
15-
CMD ["/usr/local/bin/groot"]
23+
CMD ["/groot"]

0 commit comments

Comments
 (0)