generated from HugoRCD/nuxt3-boilerplate
-
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.
Add Docker workflow and update build process
Introduced a new GitHub Actions workflow to automatically build and push Docker images for the application. The workflow triggers on pushes to main branch, tag creation, or manual dispatch. It checks for changes in specific paths before proceeding with the build. Updated .gitignore to ignore .turbo files. Modified Dockerfile of the currencia app to include DATABASE_URL as an argument and environment variable. Also adjusted the build steps and added installation of curl. Adjusted nuxt.config.ts file to allow setting NITRO_PRESET from environment variables. Updated docker-compose.local.yml file to include database service configuration for local development. Added a new script "build:app" in package.json for building only the currencia app.
- Loading branch information
Showing
7 changed files
with
129 additions
and
5 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,83 @@ | ||
name: Build and Push Application Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- 'v*' | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
check-changes: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
src: ${{ steps.changes.outputs.src }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check if there are changes | ||
uses: dorny/paths-filter@v3 | ||
id: changes | ||
with: | ||
filters: | | ||
src: | ||
- 'apps/docs/**' | ||
- 'packages/nuxt/**' | ||
- 'packages/utils/**' | ||
- 'bun.lockb' | ||
build-and-push: | ||
needs: check-changes | ||
if: needs.check-changes.outputs.src == 'true' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=sha,format=long | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: ./apps/currencia/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
build-args: | | ||
TURBO_TEAM=${{ vars.TURBO_TEAM }} | ||
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }} | ||
DATABASE_URL=${{ secrets.DATABASE_URL }} |
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 |
---|---|---|
|
@@ -20,3 +20,4 @@ logs | |
# Local env files | ||
.env | ||
.vercel | ||
.turbo |
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
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
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
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