Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Commit 2ff7bcf

Browse files
committed
Add deploy action
1 parent 5f47a46 commit 2ff7bcf

2 files changed

Lines changed: 57 additions & 2 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: deploy-edgecreator
2+
3+
on:
4+
workflow_dispatch:
5+
jobs:
6+
deploy:
7+
runs-on: ubuntu-latest
8+
environment: production
9+
steps:
10+
- name: Check out repository
11+
uses: actions/checkout@master
12+
13+
- name: Download .env file
14+
uses: nicklasfrahm/scp-action@main
15+
with:
16+
direction: download
17+
host: ${{ secrets.PRODUCTION_SSH_HOST }}
18+
fingerprint: ${{ secrets.PRODUCTION_SSH_FINGERPRINT }}
19+
username: ${{ secrets.PRODUCTION_SSH_USER }}
20+
key: ${{ secrets.PRODUCTION_SSH_KEY }}
21+
source: /home/bperel/workspace/edgecreator-next/.env.prod
22+
target: .env.prod
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v1
26+
27+
- name: Login to GitHub Container Registry
28+
uses: docker/login-action@v1
29+
with:
30+
registry: ghcr.io
31+
username: bperel
32+
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
33+
34+
- name: Build and push runtime image
35+
uses: docker/build-push-action@v2
36+
with:
37+
context: .
38+
platforms: linux/x86_64
39+
push: true
40+
tags: |
41+
ghcr.io/bperel/edgecreator:latest
42+
43+
- name: Recreate container
44+
uses: appleboy/ssh-action@v0.1.4
45+
env:
46+
DOCKER_REGISTRY_TOKEN: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
47+
with:
48+
host: ${{ secrets.PRODUCTION_SSH_HOST }}
49+
username: ${{ secrets.PRODUCTION_SSH_USER }}
50+
key: ${{ secrets.PRODUCTION_SSH_KEY }}
51+
command_timeout: 2m
52+
envs: DOCKER_REGISTRY_TOKEN
53+
script: |
54+
cd workspace/edgecreator-next
55+
echo $DOCKER_REGISTRY_TOKEN | docker login ghcr.io -u bperel --password-stdin
56+
docker-compose pull && docker-compose up -d --force-recreate

docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ version: '2'
22
services:
33
web:
44
container_name: edgecreator-v3
5-
build:
6-
context: .
5+
image: ghcr.io/bperel/edgecreator
76
volumes:
87
- '../edges:/home/edges'
98
ports:

0 commit comments

Comments
 (0)