Skip to content

Fix: Dockerfile

Fix: Dockerfile #55

Workflow file for this run

name: Deploy to 247 Server
on:
push:
branches:
- main
paths:
- 'onecard-web/**'
- 'onecard-api/**'
- 'onecard-app/**'
- 'onecard-pushserver/**'
jobs:
deploy:
name: Deploy ${{ matrix.name }}
runs-on: self-hosted
strategy:
matrix:
include:
- name: onecard-web
path: onecard-web
host_port: 9413
container_port: 8000
env_secret: ENV_FILE_WEB
- name: onecard-api
path: onecard-api
host_port: 9414
container_port: 8001
env_secret: ENV_FILE_API
- name: onecard-app
path: onecard-app
host_port: 9415
container_port: 8002
env_secret: ENV_FILE_APP
- name: onecard-pushserver
path: onecard-pushserver
host_port: 9416
container_port: 5000
env_secret: ENV_FILE_NOTI
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Sync project files to target directory
run: |
rsync -av --delete --exclude '.git' \
${{ github.workspace }}/ \
/home/ubuntu/OSS-onecard/
- name: Create .env file from secrets
run: |
echo "${{ secrets[matrix.env_secret] }}" > /home/ubuntu/OSS-onecard/${{ matrix.path }}/.env
- name: Deploy to Remote Server
run: |
set -e
cd /home/ubuntu/OSS-onecard/${{ matrix.path }}
echo "Building Docker Image for ${{ matrix.name }}..."
docker build -t ${{ matrix.name }} .
echo "Removing old container if exists..."
docker stop ${{ matrix.name }} || true
docker rm ${{ matrix.name }} || true
docker network create onecard-net || true
echo "Running new container for ${{ matrix.name }}..."
docker run -d \
--name ${{ matrix.name }} \
--network onecard-net \
--env-file .env \
-p ${{ matrix.host_port }}:${{ matrix.container_port }} \
${{ matrix.name }}