Compare commits

...

3 Commits

4 changed files with 121 additions and 2 deletions

29
Dockerfile Normal file
View File

@ -0,0 +1,29 @@
FROM debian:11-slim
LABEL maintainer="Georgios Sokianos <walkero@gmail.com>"
ENV HOSTNAME=gemini.docker.localhost
ENV PACKAGES="ca-certificates \
curl \
openssl"
RUN apt-get update && apt-get -y --no-install-recommends install ${PACKAGES};
RUN useradd -m -s /bin/bash gemini
USER gemini
WORKDIR /home/gemini
RUN mkdir -p /home/gemini/content /home/gemini/server /home/gemini/certificate; \
curl -fsSL "https://github.com/mbrubeck/agate/releases/download/v3.2.4%2Bbuild/agate.x86_64-unknown-linux-gnu.gz" -o /home/gemini/server/agate.gz && \
gunzip ./server/agate.gz && \
mv ./server/agate ./server/agate-server && \
chmod +x ./server/agate-server;
EXPOSE 1965/tcp
ENTRYPOINT /home/gemini/server/agate-server \
--content /home/gemini/content \
--addr [::]:1965 --addr 0.0.0.0:1965 \
--lang en-US \
--hostname ${HOSTNAME}

47
Makefile Normal file
View File

@ -0,0 +1,47 @@
REPO ?= walkero/agate-gemini
TAG ?= 1.0
NAME ?= agate-gemini
WORKSPACE ?= -w /home/gemini/content
VOLUMES ?= -v "${PWD}/content":/home/gemini/content
PORTS ?= -p 1965:1965
.PHONY: build buildnc shell push logs clean test release
default: help
help:
@echo "This makefile helps on building agate Gemini server"
@echo "The available parameters can be seen below:"
@echo ""
@echo "build - Build the Docker image"
@echo "buildnc - Pull the latest repos' code and build the Docker image"
@echo " without using caching"
@echo "shell - Create a container with the latest Docker image and get"
@echo " into it"
@echo "clean - Remove the docker container, if this still exists."
@echo ""
build:
docker build -f ./Dockerfile \
-t $(REPO):$(TAG) .
buildnc: pullrepos
docker build --no-cache -f ./Dockerfile \
-t $(REPO):$(TAG) .
shell:
docker run -it --rm --name $(NAME) $(VOLUMES) $(WORKSPACE) $(PORTS) $(REPO):$(TAG) /bin/bash
push:
docker push $(REPO):$(TAG)
logs:
docker logs $(NAME)
clean:
-docker rm -f $(NAME)
test:
snyk test --docker $(REPO):$(TAG) --file=Dockerfile
release: build push

View File

@ -1,3 +1,40 @@
# agate-gemini
# agate-gemini docker image
A gemini server using Agate
A Gemini server using Agate.
This image is created having in mind to be used with a Traefik proxy server which will deal with the certication. That's why no certification is created inside the image in build time.
To use it with Traefik and docker-compose you need to create two files with the following content in the same folder.
.env
```
PROJECT_NAME=mygemini
HOSTNAME=mygemini.demo.com
```
docker-compose.yml
```yaml
version: "3"
services:
agate:
image: walkero/agate-gemini
container_name: "${PROJECT_NAME}_agate"
environment:
HOSTNAME: ${HOSTNAME}
volumes:
- ./content:/home/gemini/content
labels:
- "traefik.enable=true"
- traefik.tcp.routers.${PROJECT_NAME}_gemini.entrypoints=gemini
- traefik.tcp.routers.${PROJECT_NAME}_gemini.rule=HostSNI(`*`)
- traefik.tcp.routers.${PROJECT_NAME}_gemini.service=${PROJECT_NAME}_gemini
- traefik.tcp.services.${PROJECT_NAME}_gemini.loadbalancer.server.port=1965
```
To create the container you just need to run:
```
docker-compose up -d
```
Your gemtext files should be added at the `content` folder. Those are accessible from the container as well.

6
content/index.gmi Normal file
View File

@ -0,0 +1,6 @@
# This is Sample Gemini page
## With header 1 and header 2
And a short paragraph like this.
=> /index.gmi Link to the same page
# HELLO WORLD