-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from vasgat/staging
Add Dockerfile and GitHub Actions workflow to automate building and p…
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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;"] |