-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
43 lines (32 loc) · 1.27 KB
/
Dockerfile
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
# Builder
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23-bookworm AS builder
LABEL org.opencontainers.image.source=https://github.com/ipfs/someguy
LABEL org.opencontainers.image.documentation=https://github.com/ipfs/someguy#docker
LABEL org.opencontainers.image.description="A standalone delegated /routing/v1 HTTP server for IPFS systems"
LABEL org.opencontainers.image.licenses=MIT+APACHE_2.0
ARG TARGETPLATFORM TARGETOS TARGETARCH
ENV GOPATH /go
ENV SRC_PATH $GOPATH/src/github.com/ipfs/someguy
ENV GO111MODULE on
ENV GOPROXY https://proxy.golang.org
COPY go.* $SRC_PATH/
WORKDIR $SRC_PATH
RUN go mod download
COPY . $SRC_PATH
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o $GOPATH/bin/someguy
# Runner
FROM debian:bookworm-slim
RUN apt-get update && \
apt-get install --no-install-recommends -y tini ca-certificates curl && \
rm -rf /var/lib/apt/lists/*
ENV GOPATH /go
ENV SRC_PATH $GOPATH/src/github.com/ipfs/someguy
ENV DATA_PATH /data/someguy
COPY --from=builder $GOPATH/bin/someguy /usr/local/bin/someguy
RUN mkdir -p $DATA_PATH && \
useradd -d $DATA_PATH -u 1000 -G users ipfs && \
chown ipfs:users $DATA_PATH
VOLUME $DATA_PATH
WORKDIR $DATA_PATH
USER ipfs
ENTRYPOINT ["tini", "--", "/usr/local/bin/someguy", "start"]