From b912d650a45b04fe4e0f841f2981c9a6fca24523 Mon Sep 17 00:00:00 2001 From: George Sokianos Date: Sun, 29 Jan 2023 14:22:17 +0000 Subject: [PATCH] Added dockerfile and make file to build the Agate server --- Dockerfile | 29 +++++++++++++++++++++++++++++ Makefile | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 Dockerfile create mode 100644 Makefile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..28fe849 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM debian:11-slim +LABEL maintainer="Georgios Sokianos " + +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} \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bbc64f7 --- /dev/null +++ b/Makefile @@ -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