Merge pull request #41 from DevKor-github/refactor #98
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: docker-build | |
on: | |
push: | |
branches: ['main'] | |
env: | |
DOCKER_IMAGE: ghcr.io/overthestream/kudog | |
DOCKER_CONTAINER: kudog | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout Source Code | |
uses: actions/checkout@v3 | |
- name: Setup Docker | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: docker login | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GHCR_ACCESS_TOKEN }} | |
- name: build and push image | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: ${{ env.DOCKER_IMAGE }}:latest | |
deploy: | |
needs: build | |
runs-on: self-hosted | |
steps: | |
- name: setup .env | |
run: | | |
echo "DB_HOST=${{ secrets.DB_HOST }}" >> .env | |
echo "DB_PORT=${{ secrets.DB_PORT }}" >> .env | |
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> .env | |
echo "DB_USERNAME=${{ secrets.DB_USERNAME }}" >> .env | |
echo "DB_DATABASE=${{ secrets.DB_DATABASE }}" >> .env | |
echo "MAIL_USER=${{ secrets.MAIL_USER }}" >> .env | |
echo "MAIL_PW=${{ secrets.MAIL_PW }}" >> .env | |
echo "JWT_SECRET_KEY=${{ secrets.JWT_SECRET_KEY }}" >> .env | |
echo "JWT_REFRESH_SECRET_KEY=${{ secrets.JWT_REFRESH_SECRET_KEY }}" >> .env | |
echo "CHANNEL_API_KEY=${{ secrets.CHANNEL_API_KEY }}" >> .env | |
echo "CHANNEL_API_SECRET=${{ secrets.CHANNEL_API_SECRET }}" >> .env | |
echo "DISCORD_TOKEN=${{secrets.DISCORD_TOKEN}}" >> .env | |
echo "PINPOINT_COLLECTOR_IP=${{secrets.PINPOINT_COLLECTOR_IP}}" >> .env | |
echo "PINPOINT_SAMPLING_RATE=${{secrets.PINPOINT_SAMPLING_RATE}}" >> .env | |
echo "PINPOINT_APPLICATION_NAME=${{secrets.PINPOINT_APPLICATION_NAME}}" >> .env | |
echo "PINPOINT_AGENT_ID=${{secrets.PINPOINT_AGENT_ID}}" >> .env | |
echo "FCM_TYPE=${{ secrets.FCM_TYPE }}" >> .env | |
echo "FCM_PROJECT_ID=${{ secrets.FCM_PROJECT_ID }}" >> .env | |
echo "FCM_PRIVATE_KEY_ID=${{ secrets.FCM_PRIVATE_KEY_ID }}" >> .env | |
echo "FCM_PRIVATE_KEY=${{ secrets.FCM_PRIVATE_KEY }}" >> .env | |
echo "FCM_CLIENT_EMAIL=${{ secrets.FCM_CLIENT_EMAIL }}" >> .env | |
echo "FCM_CLIENT_ID=${{ secrets.FCM_CLIENT_ID }}" >> .env | |
echo "FCM_AUTH_URI=${{ secrets.FCM_AUTH_URI }}" >> .env | |
echo "FCM_TOKEN_URI=${{ secrets.FCM_TOKEN_URI }}" >> .env | |
echo "FCM_AUTH_CERT_URL=${{ secrets.FCM_AUTH_CERT_URL }}" >> .env | |
echo "FCM_CLIENT_CERT_URL=${{ secrets.FCM_CLIENT_CERT_URL }}" >> .env | |
echo "FCM_UNIVERSE_DOMAIN=${{ secrets.FCM_UNIVERSE_DOMAIN }}" >> .env | |
echo "PY_TOKEN=${{ secrets.PY_TOKEN }}" >> .env | |
cat .env | |
- name: Run Docker | |
run: | | |
docker stop ${{env.DOCKER_CONTAINER}} && docker rm ${{env.DOCKER_CONTAINER}} && docker rmi ${{env.DOCKER_IMAGE}}:latest | |
docker run --env-file ./.env -d -p 3050:3050 --name ${{env.DOCKER_CONTAINER}} --network host --restart always ${{env.DOCKER_IMAGE}}:latest |