From 2e1800a37520592d4a81ac713cb320877a86095f Mon Sep 17 00:00:00 2001 From: Ben K Date: Fri, 9 Apr 2021 11:57:03 +0200 Subject: [PATCH] added docker support --- tools/docker/Dockerfile | 16 ++++++++++++++ tools/docker/README.md | 49 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 tools/docker/Dockerfile create mode 100644 tools/docker/README.md diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile new file mode 100644 index 0000000..1b95fe4 --- /dev/null +++ b/tools/docker/Dockerfile @@ -0,0 +1,16 @@ +FROM alpine:latest +RUN apk update +RUN apk add cargo +RUN wget https://github.com/mbrubeck/agate/archive/refs/tags/v3.0.2.tar.gz +RUN tar xzf v3.0.2.tar.gz +RUN ls / +RUN mv /agate-3.0.2 /agate +WORKDIR "/agate" +RUN ls +RUN cargo build --release +RUN mkdir /gmi/ +CMD /agate/target/release/agate --content /gmi/ \ + --addr [::]:1965 \ + --addr 0.0.0.0:1965 \ + --hostname $GEMINI_HOST \ + --lang $GEMINI_LANG diff --git a/tools/docker/README.md b/tools/docker/README.md new file mode 100644 index 0000000..ab815f3 --- /dev/null +++ b/tools/docker/README.md @@ -0,0 +1,49 @@ +# Install agate in a docker container +(these instructions assume you use linux and have some experience with both docker and the command line) +## obtain the source code + +There are currently no container images online so you have to build the image yourself before you can use it. +There are two options available for this: downloading a release or cloning the repository with `git`. +I will explain both methods but if you're unsure which method to use, I would recommend the release for new comers because it's probably more tested so you'll encounter less problems. + +### downloading the release tarball + +Download the tarball. Go to [https://github.com/mbrubeck/agate/releases/latest](https://github.com/mbrubeck/agate/releases/latest), and copy the url of the source code tarball. + +``` +wget URL +``` + +Then unpack the tarball and remove it afterwards: +``` +tar -xzf tarball.tar.gz +rm tarball.tar.gz +``` + +### clone the repository with git + +I assume you have git already installed. If not, please search on how to do it in the internet. +```git clone https://github.com/mbrubeck/agate +cd agate +``` + +## build the image +Enter the `tools/docker` directory: + +``` +cd tools/docker +``` +And now build the docker image: + +``` +docker build -t agate . +``` +This process will take a few minutes because all the rust modules have to be compiled from source. + +## start the docker container + +```docker run -t -d --name agate -p 1965:1965 -d /var/www/gmi/:/gmi/ -d /var/www/gmi/.certificates/:/agate/.certificates/ -e GEMINI_HOST=my.gemini.space -e GEMINI_LANG=en-US agate:latest``` + +You have to replace `/var/www/gmi/` with the folder where you'd like to have gemtext files and `/var/www/gmi/.certificates/` with the folder where you'd like to have your certificates stored. You also have to have to replace `my.gemini.space` with your domain name and if plan to speak in a different language than english in your gemini space than you should replace `en-US` with your countries language code (for example de-DE or fr-CA). + +## That's it! Now have agate running in a docker container!