-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (18 loc) · 830 Bytes
/
Copy pathDockerfile
File metadata and controls
27 lines (18 loc) · 830 Bytes
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
FROM golang:1.21-alpine AS builder
WORKDIR /app
# Copy source code
COPY main.go /app/
# Build for multiple architectures
RUN GOOS=linux GOARCH=amd64 go build -o traefik-cert-extractor.amd64 main.go && \
GOOS=linux GOARCH=arm64 go build -o traefik-cert-extractor.arm64 main.go
FROM alpine:3.19
WORKDIR /app
# Copy the compiled binaries from the builder stage
COPY --from=builder /app/traefik-cert-extractor.amd64 /app/
COPY --from=builder /app/traefik-cert-extractor.arm64 /app/
# Copy HTML template
COPY index.html /app/
# Create volumes for acme.json and extracted certificates
VOLUME ["/acme", "/extracted-certs"]
# Run the appropriate binary based on architecture
CMD ["sh", "-c", "if [ \"$(uname -m)\" = \"aarch64\" ]; then exec /app/traefik-cert-extractor.arm64; else exec /app/traefik-cert-extractor.amd64; fi"]