Skip to content

Commit 76a51f3

Browse files
committed
[DEV] Add Watchtower and GitHub actions to support automatic deployments
1 parent 1c6f281 commit 76a51f3

2 files changed

Lines changed: 58 additions & 1 deletion

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build and Publish Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v1
20+
21+
- name: Log in to GitHub Container Registry
22+
uses: docker/login-action@v2
23+
with:
24+
registry: ghcr.io
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Build Docker image
29+
run: |
30+
docker build -t ghcr.io/${{ github.repository_owner }}/fdd-editor:${{ github.sha }} .
31+
32+
- name: Push Docker image
33+
run: |
34+
docker push ghcr.io/${{ github.repository_owner }}/fdd-editor:${{ github.sha }}
35+
36+
- name: Tag Docker image with version
37+
if: startsWith(github.ref, 'refs/tags')
38+
run: |
39+
docker tag ghcr.io/${{ github.repository_owner }}/fdd-editor:${{ github.sha }} ghcr.io/${{ github.repository_owner }}/fdd-editor:${{ github.ref_name }}
40+
docker push ghcr.io/${{ github.repository_owner }}/fdd-editor:${{ github.ref_name }}
41+
42+
- name: Tag Docker image as latest
43+
run: |
44+
docker tag ghcr.io/${{ github.repository_owner }}/fdd-editor:${{ github.sha }} ghcr.io/${{ github.repository_owner }}/fdd-editor:latest
45+
docker push ghcr.io/${{ github.repository_owner }}/fdd-editor:latest

docker-compose.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
services:
2+
editor_watchtower:
3+
image: containrrr/watchtower
4+
command:
5+
- "--label-enable"
6+
- "--interval"
7+
- "30"
8+
- "--rolling-restart"
9+
volumes:
10+
- /var/run/docker.sock:/var/run/docker.sock
11+
212
editorfrontend:
3-
build: .
13+
image: ghcr.io/firstdarkdev/fdd-editor:latest
414
container_name: "editor_frontend"
515
restart: unless-stopped
16+
labels:
17+
- "com.centurylinklabs.watchtower.enable=true"
618
networks:
719
- fdd-docker
820
ports:

0 commit comments

Comments
 (0)