Skip to content

Commit

Permalink
feat: add docker build action
Browse files Browse the repository at this point in the history
  • Loading branch information
julienc91 committed Nov 27, 2024
1 parent 80ad11f commit 365c8ac
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 5 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and Push Docker Image

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and Push Docker Image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.sha }}
clean:
name: Delete old images
needs: release
runs-on: ubuntu-latest
steps:
- uses: snok/[email protected]
with:
account: user
token: ${{ secrets.GITHUB_TOKEN }}
image-names: ${{ github.repository }}
cut-off: 4w
keep-n-most-recent: 5
11 changes: 6 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
version: '3'
services:
webapp:
build:
context: .
image: ghcr.io/julienc91/ezshare:latest
pull_policy: always
ports:
- '127.0.0.1:3000:3000'
restart: always

peerjs:
build:
context: .
image: ghcr.io/julienc91/ezshare:latest
pull_policy: always
command: yarn peerjs --port 9000
ports:
- '127.0.0.1:9000:9000'
restart: always

0 comments on commit 365c8ac

Please sign in to comment.