Push core_api image #6
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: Push core_api image | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: "Environment" | |
required: true | |
default: "staging" | |
jobs: | |
push_image: | |
runs-on: ubuntu-latest | |
environment: ${{ github.event.inputs.environment }} | |
env: | |
PORT: 3002 | |
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
POSTGRES_DB: ${{ secrets.POSTGRES_DB }} | |
DATABASE_URL: postgresql://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@db:5432/${{ secrets.POSTGRES_DB }}?schema=public | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
STAGE: staging | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "18.13" | |
- name: Get version | |
id: package | |
run: echo "::set-output name=version::$(node -p "require('./core_api/package.json').version")" | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./core_api/Dockerfile | |
target: final | |
push: true | |
tags: | | |
${{ secrets.DOCKERHUB_USERNAME }}/composite-core_api:${{ steps.package.outputs.version }}, | |
${{ secrets.DOCKERHUB_USERNAME }}/composite-core_api:latest | |
build-args: | | |
POSTGRES_USER=${{ secrets.POSTGRES_USER }} | |
POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} | |
POSTGRES_DB=${{ secrets.POSTGRES_DB }} | |
NPM_TOKEN=${{ secrets.NPM_TOKEN }} |