diff --git a/.github/workflows/docker-push.yml b/.github/workflows/docker-push.yml new file mode 100644 index 0000000..6d3254b --- /dev/null +++ b/.github/workflows/docker-push.yml @@ -0,0 +1,30 @@ +name: Build and Push Docker image + +on: + push: + branches: + - master + +jobs: + build_and_push: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: true + tags: ipajudd/oxbot:latest diff --git a/Dockerfile b/Dockerfile index 6bfbd81..2423c08 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,6 @@ WORKDIR /app RUN npm install -g pnpm COPY package.json pnpm-lock.yaml ./ - RUN pnpm install --frozen-lockfile COPY . . diff --git a/docker-compose.production.yaml b/docker-compose.production.yaml index 8e6d99e..5580dd5 100644 --- a/docker-compose.production.yaml +++ b/docker-compose.production.yaml @@ -1,7 +1,21 @@ version: '3.9' + services: bot: container_name: oxbot build: . restart: unless-stopped command: pnpm start:production + volumes: + - db-data:/app/prisma + environment: + - DATABASE_URL=file:/app/prisma/data.db + + watchtower: + image: containrrr/watchtower + volumes: + - /var/run/docker.sock:/var/run/docker.sock + command: --interval 600 oxbot # Polls every 10 minutes and updates only the 'oxbot' container + +volumes: + db-data: \ No newline at end of file