Aaron Fischer
d0d2c2e64f
PR is open for a month now, so I've added it directly to the docker image to stop waiting. https://code.rocketnine.space/tslocum/twins/pulls/10
43 lines
1.1 KiB
Docker
43 lines
1.1 KiB
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 patch git
|
|
WORKDIR /build
|
|
COPY ./localhost.cnf /build/localhost.cnf
|
|
RUN git clone https://code.rocketnine.space/tslocum/twins.git
|
|
|
|
# Apply a needed patch
|
|
COPY ./path-10.patch /build/path-10.patch
|
|
RUN cd /build/twins && patch /build/path-10.patch
|
|
|
|
RUN cd /build/twins && go build
|
|
|
|
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 /build/twins/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"]
|
|
|