diff --git a/.github/deploy.yml b/.github/deploy.yml new file mode 100644 index 0000000..1c9e91a --- /dev/null +++ b/.github/deploy.yml @@ -0,0 +1,20 @@ +name: Deploy + +on: + push: + branches: ['master'] + pull_request: + branches: ['master'] + +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 "TOKEN=${{ secrets.TOKEN }}" --restart always -p 2020:2020 --name ${{ github.event.repository.name }} ${{ github.repository }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6199b04 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM node:latest +WORKDIR /app +COPY ./ ./ +RUN npm install +CMD ["npm", "run", "start"]