From df646a0f80c7e0f3e44cd7b27497bd0870f5eb1f Mon Sep 17 00:00:00 2001 From: Stanislaw <62724833+BoberITman@users.noreply.github.com> Date: Fri, 16 Dec 2022 21:46:53 +0100 Subject: [PATCH] CI/CD --- .github/deploy.yml | 20 ++++++++++++++++++++ Dockerfile | 5 +++++ 2 files changed, 25 insertions(+) create mode 100644 .github/deploy.yml create mode 100644 Dockerfile diff --git a/.github/deploy.yml b/.github/deploy.yml new file mode 100644 index 0000000..e13a5f6 --- /dev/null +++ b/.github/deploy.yml @@ -0,0 +1,20 @@ +name: Deploy + +on: + push: + branches: ['main'] + pull_request: + branches: ['main'] + +jobs: + build: + runs-on: self-hosted + steps: + - uses: actions/checkout@v3 + - name: Build image + run: docker build -t ${{ github.repository }} . + - name: Deploy image + run: | + docker stop ${{ github.event.repository.name }} || true + docker rm ${{ github.event.repository.name }} || true + docker run -d -e "DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }}" -e "REDIS_TOKEN=${{ secrets.REDIS_TOKEN }}" -e "DATABASE_URL=${{ secrets.DATABASE_URL }}" --restart always --network BOT --name ${{ github.event.repository.name }} ${{ github.repository }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3332c50 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM node:16.10.0 +WORKDIR /app +COPY ./ ./ +RUN npm install +CMD ["npm", "run", "start"] \ No newline at end of file