Closed RealOrangeOne closed 3 years ago
Ensure the docker container is easily accessible (GitHub's registry requires auth, even for public containers, so isn't ideal)
So we should use the official Docker registry. It would allow easy access. Would it be possible to push to the official docker registry instead or additional to the Github registry?
Yeah that's my plan!
I've created https://hub.docker.com/orgs/selfhostedshow, although now need to work out a nice way of pushing the image automatically, without using my own auth tokens or using a bot user.
Another option would be to rewrite everything into a single Dockerfile containing a build step to build the static pages and one with the nginx installation + the static pages. It shouldn't be to hard to make it, but I don't know if you want it that way... I would be able to create an all-in-one Dockerfile in a Pull-request if you are interested in it
@pagdot how would that fix things? We've got the container building just fine, we just need somewhere to put it.
Sorry, forgot to write most of it :facepalm:
I've meant building the container on the docker hub. As far as I know the docker hub doesn't support dependencies, which would requeire building a single Dockerfile. That's why we'd need to merge everything into one Dockerfile. As there is already a build pipeline using Github I don't think it that you would want it that way.
This is finally done. 🥇
Github action and a Linode did the trick. Action performs basic smoketest, then connects to Linode via SSH and builds the wiki using a container and outputs it to site/
directory. Nginx is running on the Linode which volume bind mounts that site/
directory.
name: Deploy to Linode
on:
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Smoketest
- name: Build the wiki
run: docker-compose up -d
- name: Test container comes up and listens on port 8000
run: docker run --network container:wiki_wiki_1 curlimages/curl -s --retry 10 --retry-connrefused http://localhost:8000/
# Build
- name: Pull latest changes on Linode node
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.WIKI_HOST }}
USERNAME: ${{ secrets.WIKI_DEPLOY_USER }}
PORT: ${{ secrets.WIKI_SSH_PORT }}
KEY: ${{ secrets.SSHKEY }}
script: cd ${{ secrets.PROJECT_PATH }} && git pull
- name: Build
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.WIKI_HOST }}
USERNAME: ${{ secrets.WIKI_DEPLOY_USER }}
PORT: ${{ secrets.WIKI_SSH_PORT }}
KEY: ${{ secrets.SSHKEY }}
script: cd ${{ secrets.PROJECT_PATH }} && docker-compose build
# Deploy
- name: Deploy new image and cleanup
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.WIKI_HOST }}
USERNAME: ${{ secrets.WIKI_DEPLOY_USER }}
PORT: ${{ secrets.WIKI_SSH_PORT }}
KEY: ${{ secrets.SSHKEY }}
script: docker-compose up -d && docker image prune -af
For we are not hypocrites, we should be self-hosting this wiki! The intention is to host the web service itself, and CI further down the line, not the Git repo itself.
Related: #40