Added dockerfile and make file to build the Agate server

This commit is contained in:
George Sokianos 2023-01-29 14:22:17 +00:00
parent be8447b163
commit b912d650a4
2 changed files with 76 additions and 0 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