Skip to content

Commit

Permalink
Merge pull request #19 from vasgat/staging
Browse files Browse the repository at this point in the history
Add Dockerfile and GitHub Actions workflow to automate building and p…
  • Loading branch information
vasgat authored Nov 15, 2024
2 parents 37afc42 + c279c2c commit 3e05387
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and publish Docker image

on:
push:
branches: [ main, staging ]

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

permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for Docker
id: meta
uses: docker/[email protected]
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value={{sha}}
- name: Build and push Docker image
uses: docker/[email protected]
with:
push: true
file: docker/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
11 changes: 11 additions & 0 deletions docker/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Use the official Nginx image as the base image
FROM nginx:latest

# Copy your static site files to the Nginx default directory
COPY ../dist /usr/share/nginx/html

# Expose port 80 to allow traffic
EXPOSE 80

# Start Nginx
CMD ["nginx", "-g", "daemon off;"]

0 comments on commit 3e05387

Please sign in to comment.