Initial insert

This commit is contained in:
Aaron Fischer 2021-05-06 20:56:34 +02:00
commit 856d524707
4 changed files with 68 additions and 0 deletions

35
Dockerfile Normal file
View file

@ -0,0 +1,35 @@
# 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"]

7
docker-compose.yml Normal file
View file

@ -0,0 +1,7 @@
version: "3"
services:
twins:
build: .
ports:
- 1965:1965

11
localhost.cnf Normal file
View file

@ -0,0 +1,11 @@
[dn]
CN=localhost
[req]
distinguished_name = dn
[EXT]
subjectAltName=DNS:localhost
keyUsage=digitalSignature
extendedKeyUsage=serverAuth

15
twins.ini Normal file
View file

@ -0,0 +1,15 @@
listen: :1965
disablehttps: true
disablesize: true
hosts:
default:
paths:
- lang: en
symlinks: false
localhost:
cert: /app/certs/localhost.crt
key: /app/certs/localhost.key
paths:
- path: /
command: echo "Welcome to twins"