-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDockerfile
More file actions
89 lines (69 loc) · 2.32 KB
/
Dockerfile
File metadata and controls
89 lines (69 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# ============================================
# Build stage (shared)
# ============================================
FROM golang:1.25.3-trixie AS build
# Docker sets TARGETARCH automatically during multi-platform builds
ARG TARGETARCH
WORKDIR /go/src/guppy
COPY go.* .
RUN go mod download
COPY . .
# Production build - with symbol stripping
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} make guppy-prod
# ============================================
# Debug build stage
# ============================================
FROM build AS build-debug
ARG TARGETARCH
# Install delve debugger and randdir tool for target architecture
RUN GOARCH=${TARGETARCH} go install github.com/go-delve/delve/cmd/dlv@latest && \
GOARCH=${TARGETARCH} go install github.com/storacha/randdir@latest
# Debug build - no optimizations, no inlining
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} make guppy-debug
# ============================================
# Production image
# ============================================
FROM debian:bookworm-slim AS prod
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /go/src/guppy/guppy /usr/bin/guppy
ENTRYPOINT ["/usr/bin/guppy"]
# ============================================
# Development image
# ============================================
FROM debian:bookworm-slim AS dev
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
# Shell experience
bash-completion \
less \
vim-tiny \
# Process debugging
procps \
htop \
strace \
# Network debugging
iputils-ping \
dnsutils \
net-tools \
tcpdump \
# Data tools
jq \
&& rm -rf /var/lib/apt/lists/*
# Delve debugger and randdir tool
COPY --from=build-debug /go/bin/dlv /usr/bin/dlv
COPY --from=build-debug /go/bin/randdir /usr/bin/randdir
# Debug binary (with symbols, no optimizations)
COPY --from=build-debug /go/src/guppy/guppy /usr/bin/guppy
# Create data directories
RUN mkdir -p /root/.storacha/guppy /root/.config/guppy
WORKDIR /root
# Shell niceties
ENV TERM=xterm-256color
RUN echo 'alias ll="ls -la"' >> /etc/bash.bashrc && \
echo 'PS1="\[\e[32m\][guppy-dev]\[\e[m\] \w# "' >> /etc/bash.bashrc
SHELL ["/bin/bash", "-c"]
ENTRYPOINT ["/usr/bin/guppy"]