Commit d4e452cb authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Merge branch 'deployment' into 'main'

Automatic deployment via GitLab CI

See merge request !2
parents b1c82686 28f61282
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+38 −0
Original line number Diff line number Diff line
# vim: tabstop=4 shiftwidth=4 softtabstop=4

default:
    image: "archlinux:latest"
    tags:
        - docker
    before_script:
        - pacman -Suy --noconfirm --needed openssh docker-compose

variables:
    DEPLOY_HOST: vz.fjfi.cvut.cz
    DEPLOY_USER: docker-compose-deploy

stages:
    - deploy

deploy:
    stage: deploy
    rules:
        - if: '"$DEPLOY_SSH_KEY" != "" && "$CI_COMMIT_REF_NAME" == "$CI_DEFAULT_BRANCH"'
    script:
        # Set up SSH
        - eval $(ssh-agent -s)
        - echo "$DEPLOY_SSH_KEY" | base64 -d | ssh-add - > /dev/null
        - mkdir "$HOME/.ssh"
        - echo "$DEPLOY_HOSTKEY" | base64 -d >> "$HOME/.ssh/known_hosts"
        # The native SSH support in docker/docker-compose is rather flaky:
        # https://github.com/docker/compose/issues/8544
        # The solution is to set up the unix socket forwarding via OpenSSH:
        - ssh -M -S docker-ctrl-socket -fnNT -L /tmp/docker.sock:/var/run/docker.sock "$DEPLOY_USER@$DEPLOY_HOST"
        - export DOCKER_HOST="unix:///tmp/docker.sock"
        # Deploy with docker-compose on the remote host
        - docker-compose down --remove-orphans
        - docker-compose pull --quiet
        - docker-compose up --detach --wait
        # Clean up the socket forwarding
        - ssh -q -S docker-ctrl-socket -O exit "$DEPLOY_USER@$DEPLOY_HOST"
        - rm -f /tmp/docker.sock
+2 −0
Original line number Diff line number Diff line
# Medical Tools

__Note:__ The top-level [docker-compose.yml](docker-compose.yml) file is for
deployment on https://vz.fjfi.cvut.cz – do not use it for development!
+0 −0

File moved.

+0 −0

File moved.

+0 −0

File moved.

Loading