diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..8b5f2eb --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,37 @@ +name: Build Docker Image +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/test-crawlab.yml b/.github/workflows/test-crawlab.yml deleted file mode 100644 index 030ce55..0000000 --- a/.github/workflows/test-crawlab.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Test Crawlab -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] -jobs: - test: - services: - crawlab: - image: crawlabteam/crawlab:develop - ports: - - 8080:8080 - env: - CRAWLAB_NODE_MASTER: "true" - CRAWLAB_MONGO_HOST: mongo - CRAWLAB_MONGO_PORT: 27017 - mongo: - image: mongo:latest - ports: - - 27017:27017 - timeout-minutes: 60 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: lts/* - - name: Install pnpm - run: npm i -g pnpm@9 - - name: Install dependencies - run: pnpm install - - name: Install Playwright Browsers - run: pnpm exec playwright install --with-deps - - name: Run Playwright tests - run: pnpm playwright test - - uses: actions/upload-artifact@v4 - if: always() - with: - name: playwright-report - path: playwright-report/ - retention-days: 30 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..053f3f8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Use the official Playwright image +FROM mcr.microsoft.com/playwright:v1.42.1-jammy + +# Set the working directory in the container +WORKDIR /app + +# Install pnpm +RUN npm install -g pnpm + +# Copy pnpm-lock.yaml (if available) +COPY pnpm-lock.yaml ./ + +# Install project dependencies +RUN pnpm install --frozen-lockfile + +# Copy the rest of the application code +COPY . . + +# Set the command to run Playwright tests +CMD ["pnpm", "exec", "playwright", "test"] \ No newline at end of file