-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (34 loc) · 1.28 KB
/
Dockerfile
File metadata and controls
47 lines (34 loc) · 1.28 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
# GoReleaser Dockerfile - uses pre-built binaries from build context
# Builder stage for cloudflared
FROM golang:1.24.5-alpine3.22 AS cloudflared
# Install build dependencies
RUN apk --no-cache add \
git \
make \
gcc \
musl-dev
# Clone cloudflared repository
RUN git clone --depth 1 https://github.com/cloudflare/cloudflared.git /go/src/cloudflared
# Set the working directory for cloudflared build
WORKDIR /go/src/cloudflared
# Build cloudflared from latest
RUN make cloudflared
# Final runtime stage
FROM alpine:3.22.1 AS runtime
# Install runtime dependencies and setup in a single layer
RUN apk --no-cache add ca-certificates && \
adduser -D -s /bin/sh moley
# Copy cloudflared binary from builder stage
COPY --from=cloudflared /go/src/cloudflared/cloudflared /usr/local/bin/cloudflared
# Copy the pre-built binary from GoReleaser build context
# GoReleaser provides the binary directly in the build context
COPY moley /usr/local/bin/moley
# Make binaries executable and set proper ownership in a single layer
RUN chmod +x /usr/local/bin/cloudflared /usr/local/bin/moley && \
chown root:root /usr/local/bin/cloudflared /usr/local/bin/moley
# Set working directory
WORKDIR /usr/local/bin
# Switch to non-root user for security
USER moley
ENTRYPOINT ["moley"]
CMD ["--help"]