Skip to content

build(Dockerfile): add copy env step #6

build(Dockerfile): add copy env step

build(Dockerfile): add copy env step #6

Workflow file for this run

name: fogfog-server-dev
on:
push:
branches: [feature/83]
jobs:
build:
name: build pipeline
# env:
# PORT: ${{ secrets.PORT }}
# MONGODB_URI_DEV: ${{ secrets.MONGODB_URI_DEV }}
# MONGODB_URI_PROD: ${{ secrets.MONGODB_URI_PROD }}
# REGION: ${{ secrets.REGION }}
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn
- name: Run build
run: yarn build
deploy:
name: deploy pipeline
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: ['20.x']
needs: build
steps:
- uses: actions/checkout@v2
- name: Create .env file
run: |
touch .env
echo PORT=8081 >> .env
echo DATABASE_URL=${{ secrets.DATABASE_URL }} >> .env
echo SENTRY_WEBHOOK_URL=${{ secrets.SENTRY_WEBHOOK_URL }} >> .env
echo SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> .env
echo KAKAO_CLIENT_ID=${{ secrets.KAKAO_CLIENT_ID }} >> .env
echo KAKAO_REDIRECT_URL=${{ secrets.KAKAO_REDIRECT_URL }} >> .env
echo KAKAO_ADMIN_KEY=${{ secrets.KAKAO_ADMIN_KEY }} >> .env
echo ACCESS_TOKEN_SECRET=${{ secrets.ACCESS_TOKEN_SECRET }} >> .env
echo REFRESH_TOKEN_SECRET=${{ secrets.REFRESH_TOKEN_SECRET }} >> .env
echo DEFAULT_IMAGE=${{ secrets.DEFAULT_IMAGE }} >> .env
echo APPLE_CLIENTID=${{ secrets.APPLE_CLIENTID }} >> .env
echo APPLE_TEAMID=${{ secrets.APPLE_TEAMID }} >> .env
echo APPLE_KEYFILE_PATH=${{ secrets.APPLE_KEYFILE_PATH }} >> .env
echo APPLE_KEYID=${{ secrets.APPLE_KEYID }} >> .env
cat .env
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn
- name: Run build
run: yarn build
- name: Create apple .p8
run: |
cd dist
touch ${{ secrets.APPLE_KEYFILE_PATH }}
echo "${{ secrets.APPLE_PRIVATE_KEY }}" > ${{ secrets.APPLE_KEYFILE_PATH }}
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{secrets.DOCKER_HUB_USERNAME}}
password: ${{secrets.DOCKER_HUB_TOKEN}}
- name: build and tagging release to DockerHub
env:
NAME: ${{secrets.DOCKER_HUB_USERNAME}}
REPO: fogfogdev
run: |
shortHash=$(git rev-parse --short ${{ github.sha }})
docker build -t $REPO -f Dockerfile.dev .
docker tag $REPO:latest $NAME/$REPO:latest
docker tag $REPO:latest $NAME/$REPO:dev
docker tag $REPO:latest $NAME/$REPO:dev-$shortHash
docker push $NAME/$REPO:latest
docker push $NAME/$REPO:dev
docker push $NAME/$REPO:dev-$shortHash
# - name: Run Deploy Script
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.REMOTE_IP }}
# username: ${{ secrets.REMOTE_SSH_ID }}
# key: ${{ secrets.REMOTE_SSH_KEY }}
# port: ${{ secrets.REMOTE_SSH_PORT }}
# script: |
# cd /opt/fogfog/docker
# sudo /opt/fogfog/docker/dev-deploy.sh
- name: action-slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: Github Action Push Server
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
if: always() # Pick up events even if the job fails or is canceled.