Skip to content

fix Dockerfile, nginx config #6

fix Dockerfile, nginx config

fix Dockerfile, nginx config #6

Workflow file for this run

name: Deploy to Server
on:
push:
branches:
- main
pull_request:
types:
- closed
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Make envfile
id: envfile
uses: SpicyPizza/create-envfile@v2.0
with:
envkey_COMPOSE_PROJECT_NAME: ${{ secrets.COMPOSE_PROJECT_NAME }}
envkey_CN: ${{ secrets.CN }}
envkey_DIN: ${{ secrets.DIN }}
envkey_DIV: ${{ secrets.DIV }}
envkey_DLU: ${{ secrets.DLU }}
envkey_DLP: ${{ secrets.DLP }}
envkey_DCF: ${{ secrets.DCF }}
envkey_ED: ${{ secrets.ED }}
envkey_EP: ${{ secrets.EP }}
envkey_EF: ${{ secrets.EF }}
envkey_REPO: ${{ secrets.REPO }}
directory: ops
file_name: .env.prod
fail_on_empty: false
sort_keys: false
- name: Build and push Docker image
env:
DLU: ${{ secrets.DLU }}
DLP: ${{ secrets.DLP }}
DIN: ${{ secrets.DIN}}
DIV: ${{ secrets.DIV}}
run: |
docker build -t $DIN:$DIV .
echo $DLP | docker login -u $DLU --password-stdin
docker push $DIN:$DIV
- name: Setup SSH
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: SSH into the server and run the app
run: |
# Copy .env.prod to the deploy server
scp -o "StrictHostKeyChecking=no" -r ops/.env.prod ubuntu@dclm.org:/var/docker/dclm-dtc/ops
# Deploy new app
ssh -o "StrictHostKeyChecking=no" ubuntu@dclm.org "cd /var/docker/dclm-dtc && make new && make down && make up"