basic functionality

This commit is contained in:
Vivianne 2022-03-30 01:51:10 -07:00
commit ba39ec1a21
5 changed files with 68 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.crt
*.key

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM golang:1.16-alpine AS build
RUN apk add --no-cache git
WORKDIR /build
RUN git clone https://code.rocketnine.space/tslocum/twins.git
WORKDIR /build/twins
RUN go build
FROM gruebel/upx as upx
COPY --from=build /build/twins/twins /twins-uncompressed
RUN upx --best --lzma -o /twins /twins-uncompressed
FROM alpine:3.13
WORKDIR /app
COPY --from=upx /twins /app/twins
EXPOSE 1965
CMD ["/app/twins", "-config", "/app/config.yaml"]

20
README.md Normal file
View File

@ -0,0 +1,20 @@
# docker-twins
A basic Dockerfile and docker-compose file for the [twins](https://code.rocketnine.space/tslocum/twins) Gemini server.
## Certs
Don't forget to map at least one certificate and key in the docker-compose file. You will also have to reference this key in the configuration file.
## Configuration file
First, please see the [twins configuration guide](https://code.rocketnine.space/tslocum/twins/src/branch/master/CONFIGURATION.md) for information on the config format config.yaml.
The image is set up to read the configuration file from `/app/config.yaml`. You'll want to map this in your docker-compose file.
Inside your `config.yaml`, specify both `cert` and `key` with your certificate. This should match the certificate and key mapped in your docker-compose file.
## Hosting a directory
When hosting a directory you'll of course have to map it in the docker-compose file!

13
config.yaml Normal file
View File

@ -0,0 +1,13 @@
listen: :1965
hosts:
default:
cert: cert.crt
key: cert.key
paths:
- lang: en
localhost:
paths:
- path: /
command: printf "# Hello Geminaut!\nIt works! Now, you'll want to modify this config file."

15
docker-compose.yml Normal file
View File

@ -0,0 +1,15 @@
version: "3.9"
services:
twins:
image: "vivicat/twins"
build: .
volumes:
- ./config.yaml:/app/config.yaml
- ./cert.crt:/app/cert.crt
- ./cert.key:/app/cert.key
- ./capsule:/app/capsule
- ./cabbage:/app/cabbage
ports:
- "1965:1965"