2021-05-06 20:56:34 +02:00
|
|
|
# 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
|
2021-07-15 23:08:51 +02:00
|
|
|
RUN apk add --no-cache openssl patch git
|
|
|
|
WORKDIR /build
|
2021-05-06 20:56:34 +02:00
|
|
|
COPY ./localhost.cnf /build/localhost.cnf
|
2021-07-15 23:08:51 +02:00
|
|
|
RUN git clone https://code.rocketnine.space/tslocum/twins.git
|
|
|
|
|
2022-08-03 23:06:16 +02:00
|
|
|
RUN git config --global user.email "noname@example.com"
|
|
|
|
# Apply a needed patches
|
2021-07-15 23:08:51 +02:00
|
|
|
COPY ./path-10.patch /build/path-10.patch
|
2022-08-03 23:06:16 +02:00
|
|
|
RUN cd /build/twins && git am /build/path-10.patch
|
|
|
|
COPY ./activate-images-permanently.patch /build/activate-images-permanently.patch
|
|
|
|
RUN cd /build/twins && git am /build/activate-images-permanently.patch
|
2021-07-15 23:08:51 +02:00
|
|
|
|
|
|
|
RUN cd /build/twins && go build
|
|
|
|
|
2021-05-06 20:56:34 +02:00
|
|
|
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
|
2021-07-15 23:08:51 +02:00
|
|
|
COPY --from=builder /build/twins/twins /app.org
|
2021-05-06 20:56:34 +02:00
|
|
|
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"]
|
|
|
|
|