From ba39ec1a21fd803e26eee7b00926a9ef8a70bd87 Mon Sep 17 00:00:00 2001 From: Vivianne Langdon Date: Wed, 30 Mar 2022 01:51:10 -0700 Subject: [PATCH] basic functionality --- .gitignore | 2 ++ Dockerfile | 18 ++++++++++++++++++ README.md | 20 ++++++++++++++++++++ config.yaml | 13 +++++++++++++ docker-compose.yml | 15 +++++++++++++++ 5 files changed, 68 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 config.yaml create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..be870b4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.crt +*.key diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7111f2f --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..62baa87 --- /dev/null +++ b/README.md @@ -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! + diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..edfd616 --- /dev/null +++ b/config.yaml @@ -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." diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7c30f59 --- /dev/null +++ b/docker-compose.yml @@ -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" +