Fix build - Docker action #19
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
name: Publish Docker image | |
on: | |
push: | |
branches: ["main"] | |
jobs: | |
push_to_registry: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: nextcrmio/nextcrm-0.0.3-beta | |
- name: Use secrets | |
run: | | |
echo "" > .env.local # Clear the .env.local file | |
echo DATABASE_URL: ${{ secrets.DATABASE_URL }} >> .env | |
echo GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} >> .env.local | |
echo GOOGLE_ID: ${{ secrets.GOOGLE_ID }} >> .env.local | |
echo GOOGLE_SECRET: ${{ secrets.GOOGLE_SECRET }} >> .env.local | |
echo RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }} >> .env.local | |
echo DO_ENDPOINT: ${{ secrets.DO_ENDPOINT }} >> .env.local | |
echo DO_REGION: ${{ secrets.DO_REGION }} >> .env.local | |
echo DO_ACCESS_KEY_ID: ${{ secrets.DO_ACCESS_KEY_ID }} >> .env.local | |
echo DO_ACCESS_KEY_SECRET: ${{ secrets.DO_ACCESS_KEY_SECRET }} >> .env.local | |
echo DATABASE_URL: ${{ secrets.DATABASE_URL }} >> .env.local | |
echo JWT_SECRET: ${{ secrets.JWT_SECRET }} >> .env.local | |
echo NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }} >> .env.local | |
echo NEXT_PUBLIC_APP_NAME: ${{ secrets.NEXT_PUBLIC_APP_NAME }} >> .env.local | |
echo NEXT_PUBLIC_APP_V: ${{ secrets.NEXT_PUBLIC_APP_V }} >> .env.local | |
echo NEXT_PUBLIC_APP_URL: ${{ secrets.NEXT_PUBLIC_APP_URL }} >> .env.local | |
- name: Build and push Docker image | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
file: ./Dockerfile_actions # custom Dockerfile name for your github actions |