twins-docker/Dockerfile
2021-05-06 20:56:34 +02:00

35 lines
939 B
Docker

# Twins, a simple gemini server and reverse proxy
# @Author Twins: Trevor Slocum
# @Author Docker build: Aaron Fischer
# Build
FROM golang:1.16-alpine AS builder
RUN apk add --no-cache openssl
RUN go get -v code.rocketnine.space/tslocum/twins
COPY ./localhost.cnf /build/localhost.cnf
RUN openssl req \
-x509 \
-out /build/localhost.crt \
-keyout /build/localhost.key \
-newkey rsa:2048 \
-nodes \
-sha256 \
-subj '/CN=localhost' \
-extensions EXT \
-config /build/localhost.cnf
# Compress
FROM gruebel/upx:latest as upx
COPY --from=builder /go/bin/twins /app.org
RUN upx --best --lzma -o /app /app.org
# Final image
FROM alpine:3.13
WORKDIR /app
COPY --from=upx /app /app/twins
COPY ./twins.ini /app/config/twins.ini
COPY --from=builder /build/localhost.crt /app/certs/localhost.crt
COPY --from=builder /build/localhost.key /app/certs/localhost.key
EXPOSE 1965
CMD ["/app/twins", "-config", "/app/config/twins.ini"]