Skip to content

Commit

Permalink
Pipeline envs (#163)
Browse files Browse the repository at this point in the history
* fix: remove the rm step

* test: run on PR

* test: test pusher cluster env

* fix: add notification envs

* test: add pusher key

* fix: add the pusher app key

* fix: log container start output

* fix: remove the e flag

* fix: revert changes

* fix: re-add the pusher app key

* fix: add pusher app key value

* fix: typo

* fix: test env file

* fix: syntax

* fix: remove the env from run cmd

* fix: revert changes

* fix: revert changes

* fix: wrap run cmd in an if statement

* Revert "test: test pusher cluster env"

This reverts commit 57b2bbe.

* test: create env file

* test: add error handling
  • Loading branch information
ceelogre authored Dec 3, 2024
1 parent 02e8d44 commit 6d4a174
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Docker Build and Deploy

on:
push:
pull_request:
branches:
- develop

Expand All @@ -14,7 +14,7 @@ jobs:
NODE_ENV: "production"
PUSHER_CLUSTER: ${{ secrets.PUSHER_CLUSTER }}
PUSHER_APP_ID: ${{ secrets.PUSHER_APP_ID }}
PUSHER_APP_KEY: ${{ secrets.PUSHER_APP_KEY }}
PUSHER_APP_KEY: ${{ secrets.PUSHER_KEY }}
PUSHER_APP_SECRET: ${{ secrets.PUSHER_APP_SECRET }}
DEVPULSE_EMAIL: ${{ secrets.DEVPULSE_EMAIL }}

Expand All @@ -41,29 +41,29 @@ jobs:
username: ${{ secrets.DO_USERNAME }}
key: ${{ secrets.DO_KEY }}
port: ${{ secrets.DO_PORT }}
envs: MONGO_PROD_DB,REGISTER_FRONTEND_URL,REGISTER_ORG_FRONTEND_URL,NODE_ENV,FRONTEND_LINK,ADMIN_EMAIL,ADMIN_PASS,COORDINATOR_EMAIL,COORDINATOR_PASS,GH_TOKEN
envs: MONGO_PROD_DB,REGISTER_FRONTEND_URL,REGISTER_ORG_FRONTEND_URL,NODE_ENV,FRONTEND_LINK,ADMIN_EMAIL,ADMIN_PASS,COORDINATOR_EMAIL,COORDINATOR_PASS,GH_TOKEN, PUSHER_CLUSTER
script: |
echo "MONGO_PROD_DB=${MONGO_PROD_DB}" > env
echo "FRONTEND_LINK=${FRONTEND_LINK}" >> env
echo "NODE_ENV=${NODE_ENV}" >> env
echo "PUSHER_CLUSTER=${PUSHER_CLUSTER}" >> env
echo "PUSHER_APP_ID=${PUSHER_APP_ID}" >> env
echo "PUSHER_APP_KEY=${PUSHER_APP_KEY}" >> env
echo "PUSHER_APP_SECRET=${PUSHER_APP_SECRET}" >> env
echo "DEVPULSE_EMAIL=${DEVPULSE_EMAIL}" >> env
set -e # Exit immediately if a command exits with a non-zero status
set -x # Print commands and their arguments as they are executed
touch env
echo "MONGO_PROD_DB=${MONGO_PROD_DB}" >> env
# Pull the latest image
docker pull ${{ secrets.DOCKER_HUB_USERNAME2 }}/atlp-devpulse-bn:latest
# Stop and remove existing container if it exists
docker stop $(docker ps -q --filter publish=4008) || true
docker rm $(docker ps -aq --filter publish=4008) || true
# Run new container
docker run -d \
output=$( docker run -d \
-p 4008:3000 \
--env-file env \
${{ secrets.DOCKER_HUB_USERNAME2 }}/atlp-devpulse-bn:latest
${{ secrets.DOCKER_HUB_USERNAME2 }}/atlp-devpulse-bn:latest)
echo $output
echo "Container ID: $output"
if [ -z "$output" ]; then
echo "Container failed to start"
exit 1
fi
# Clean up
rm env

0 comments on commit 6d4a174

Please sign in to comment.