diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..c0f3db7 --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,40 @@ +name: Deploy on push +run-name: Deploy on push +on: + push: + branches: + - master + +jobs: + on-push-deploy_sh-edraft: + runs-on: [dobby.sh-edraft.de, ubuntu-latest] + container: catthehacker/ubuntu:act-latest + steps: + - name: Setup docker + uses: https://github.com/papodaca/install-docker-action@main + - run: docker -v + + - name: Clone Repository + uses: https://github.com/actions/checkout@v3 + with: + token: ${{ secrets.CI_ACCESS_TOKEN }} + submodules: true + + - name: Shutdown stack + run: docker stack rm code + + - name: Build code-server image + run: | + docker image prune -f + ./build + + - name: Deploy Stack to sh-edraft.de + uses: https://github.com/kgierke/portainer-stack-deployment@v1 + with: + portainer-url: "https://docker.sh-edraft.de" + portainer-username: "gitea_job" + portainer-password: "${{ secrets.docker_job }}" + portainer-endpoint: 2 + name: code + file: docker-compose.yml + variables: '{}' diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..749a616 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,27 @@ +version: "3.7" + +services: + code_server: + image: sh-edraft.de/code-server:latest + networks: + - reverse_proxy + volumes: + - /opt/code_server/.local:/home/coder/.local + - /opt/code_server/.config:/home/coder/.config + - /opt/code_server/projects:/home/coder/projects + deploy: + mode: replicated + replicas: 1 + placement: + constraints: [node.role == manager] + resources: + reservations: + cpus: "0.1" + memory: 20M + limits: + cpus: "4.0" + memory: 4096M + +networks: + reverse_proxy: + external: true \ No newline at end of file