Skip to content

Commit 4b5b2d0

Browse files
jmgrosenclaude
andcommitted
Use multi-stage build to reduce image size
Split into builder and runtime stages. Final image only contains the memtrace-viewer binary and runtime libs (78MB vs 5.9GB). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 985e3cc commit 4b5b2d0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.23
1+
FROM alpine:3.23 AS builder
22

33
RUN apk add --no-cache opam git bash gmp-dev pkgconf libffi-dev openssl-dev zlib-dev linux-headers gcc musl-dev make
44

@@ -11,6 +11,12 @@ RUN mv /usr/bin/gcc /usr/bin/gcc-real && \
1111
chmod +x /usr/bin/gcc
1212
RUN opam install memtrace_viewer.v0.18~preview.130.83+317 -y --assume-depexts
1313

14+
FROM alpine:3.23
15+
16+
RUN apk add --no-cache gmp libffi openssl zlib
17+
18+
COPY --from=builder /root/.opam/5.2/bin/memtrace-viewer /usr/local/bin/memtrace-viewer
19+
1420
EXPOSE 8080
1521

16-
ENTRYPOINT ["opam", "exec", "--", "memtrace-viewer"]
22+
ENTRYPOINT ["memtrace-viewer"]

0 commit comments

Comments
 (0)