mirror of
https://github.com/samsonjs/agate.git
synced 2026-03-25 09:05:50 +00:00
feat: Publish docker image to ghcr
This Github workflow builds & publishes an OCI/Docker container image to Github/s Container Registry (ghcr.io). It also adds a brief intro for how to use it in the README, and removes the (now outdated) `tools/docker/README.md`.
This commit is contained in:
parent
e2d9b8f975
commit
4682421306
3 changed files with 56 additions and 49 deletions
39
.github/workflows/release.yml
vendored
39
.github/workflows/release.yml
vendored
|
|
@ -71,3 +71,42 @@ jobs:
|
|||
files: 'agate.*.gz'
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
release-tag: ${{ github.ref_name }}
|
||||
|
||||
build_docker:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Log into GHCR
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Extract metadata for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}
|
||||
# Because this workflow only runs on commits tagged `v*` (i n semver format) this section ensures that
|
||||
# a docker build tagged `v1.2.3+podman.build` is tagged with `1`, `1.2`, `1.2.3` and `1.2.3+podman.build`
|
||||
# as well as being tagged with `latest`. For each of these, a subsequent build that has the same tag will
|
||||
# replace it. This means that pulling `ghcr.io/mbrubeck/agate:1` will always get the most recent image
|
||||
# released with a v1 tag, container, `ghcr.io/mbrubeck/agate:1.2` will get the latest v1.2 tag, and so on.
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}.{{patch}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
- name: Build and push Docker image
|
||||
id: push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
|
|
|||
17
README.md
17
README.md
|
|
@ -38,6 +38,23 @@ Install the package [`agate-bin`](https://aur.archlinux.org/packages/agate-bin/)
|
|||
|
||||
If you have the Rust toolchain installed, run `cargo install agate` to install agate from crates.io.
|
||||
|
||||
### Docker
|
||||
|
||||
Recent builds have also been released as OCI/Docker images on Github's Container Registry (ghcr.io). Most people will need to mount two volumes, one for your content, one for your certificates (this can be empty, they will be automatically generated if needed):
|
||||
|
||||
```sh
|
||||
$ docker run \
|
||||
-p 1965:1965 \
|
||||
-v your/path/to/gmi:/gmi \
|
||||
-v your/path/to/certs:/certs \
|
||||
ghcr.io/mbrubeck/agate:latest \
|
||||
--hostname example.org
|
||||
```
|
||||
|
||||
This container will run without a mounted certificates directory, but new certificates will be lost when it shuts down and re-generated every time it boots, showing your site's visitors a certificate warning each time your server restarts.
|
||||
|
||||
Each release is tagged with `major`, `major.minor`, `major.minor.patch`, as well as the full version string and "latest". This means `docker pull ghcr.io/mbrubeck/agate:3` will always retrieve the latest `v3.*` image, `…:3.3` the latest `v3.3.*` image, and `…:latest` the most recent release of any version.
|
||||
|
||||
### Source
|
||||
|
||||
Download the source code and run `cargo build --release` inside the source repository, then find the binary at `target/release/agate`.
|
||||
|
|
|
|||
|
|
@ -1,49 +0,0 @@
|
|||
# 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
|
||||
|
||||
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 -v path/to/gmi:/gmi:ro -v path/to/certs:/certs:rw agate:latest --hostname localhost
|
||||
```
|
||||
|
||||
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 `example.org` 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!
|
||||
Loading…
Reference in a new issue