diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..26b66f0 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,21 @@ +name: Deploy + +on: + push: + branches: ["master"] + pull_request: + types: ["closed"] + 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 -p 127.0.0.1:3000:3000 -d --name ${{ github.event.repository.name }} ${{ github.repository }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d742baf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM node:16.10.0 +WORKDIR /app +COPY ./ ./ +RUN npm install +RUN npx next build +CMD npx next start \ No newline at end of file