Skip to content

Commit

Permalink
Adding github action
Browse files Browse the repository at this point in the history
  • Loading branch information
DitchTurtL committed Dec 16, 2024
1 parent 2328380 commit 32e2189
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/docker-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build and Deploy to GitHub Packages

on:
push:
branches:
- main # Adjust to your default branch
workflow_dispatch: # Allows manual triggering of the workflow

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v3

# Step 2: Log in to GitHub Container Registry
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Step 3: Set up Docker Buildx for multi-platform builds (optional but recommended)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# Step 4: Build and push the Docker image to GitHub Container Registry
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/osf-site:latest
ghcr.io/${{ github.repository_owner }}/osf-site:${{ github.sha }}
# Step 5: Optional - Clean up unused Docker resources on the runner
- name: Prune Docker
run: docker system prune --all --force

0 comments on commit 32e2189

Please sign in to comment.