Commit 5abdc0f7 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

update CI for podman deployment

parent 6ecce88d
Loading
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
# vim: tabstop=4 shiftwidth=4 softtabstop=4

default:
    image: "archlinux:latest"
    image: "quay.io/archlinux/archlinux:latest"
    tags:
        - docker
    before_script:
        - pacman -Suy --noconfirm --needed openssh docker-compose
        - pacman -Suy --noconfirm --needed openssh podman podman-compose

variables:
    DEPLOY_HOST: vz.fjfi.cvut.cz
    DEPLOY_USER: docker-compose-deploy
    #DEPLOY_HOST: vz.fjfi.cvut.cz
    #DEPLOY_USER: webapp-medical-tools
    CONTAINER_HOST: "ssh://webapp-medical-tools@vz.fjfi.cvut.cz:22/run/user/961/podman/podman.sock"

stages:
    - deploy
@@ -31,13 +32,14 @@ deploy:
        # 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"
        #- 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 build --quiet app
        - docker-compose up --detach --wait
        - podman --remote compose down --remove-orphans
        - podman --remote compose pull
        - podman --remote compose build app
        # --pod-args: workaround for https://github.com/containers/podman-compose/issues/654
        - podman --remote compose --pod-args "--userns host" up --detach
        # Clean up the socket forwarding
        - ssh -q -S docker-ctrl-socket -O exit "$DEPLOY_USER@$DEPLOY_HOST"
        - rm -f /tmp/docker.sock
        #- ssh -q -S docker-ctrl-socket -O exit "$DEPLOY_USER@$DEPLOY_HOST"
        #- rm -f /tmp/docker.sock
+2 −1
Original line number Diff line number Diff line
@@ -6,4 +6,5 @@ services:
    ports:
      - 8080:8080
    restart: always
    userns_mode: "host"
    # NOTE: workaround for https://github.com/containers/podman-compose/issues/654
    #userns_mode: "host"