-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (34 loc) · 1.18 KB
/
Copy pathDockerfile
File metadata and controls
49 lines (34 loc) · 1.18 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
FROM golang:1.24-alpine AS builder
WORKDIR /app
COPY go.mod go.sum* ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /originless .
FROM alpine:latest
ENV STORAGE_MAX=100GB
ENV PIN_EXPIRY_DAYS=30
ENV NOSTR_NPUBS=""
ENV NOSTR_RELAYS=""
ENV ARCHIVE_DIR=/archive
ENV ARCHIVE_INTERVAL=15
ENV ARCHIVE_REPIN_HOURS=6
RUN apk add --no-cache ca-certificates gcompat kubo && \
adduser -D -h /app originless
WORKDIR /app
COPY --from=builder /originless /app/originless
RUN mkdir -p /tmp/originless /data /archive && chown -R originless:originless /app /tmp/originless /data /archive
USER originless
EXPOSE 3232 4001/tcp 4001/udp
VOLUME ["/data", "/archive"]
STOPSIGNAL SIGTERM
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 CMD wget -qO- http://127.0.0.1:3232/health || exit 1
CMD ["sh", "-c", "\
export IPFS_PATH=/data && \
if [ ! -f \"$IPFS_PATH/config\" ]; then ipfs init --profile=lowpower; fi && \
ipfs config Datastore.StorageMax ${STORAGE_MAX} && \
ipfs config --json Routing.Type '\"dhtclient\"'; \
ipfs daemon --enable-gc --routing=dhtclient & \
IPFS_PID=$! && \
export IPFS_PID && \
sleep 10 && \
exec /app/originless"]