Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
PROJECT_ID: casecomp-495718
REGION: asia-south1
SERVICE: cardscrapebot
IMAGE: gcr.io/casecomp-495718/cardscrapebot
IMAGE: gcr.io/casecomp-495718/casecomp-api

jobs:
deploy:
Expand All @@ -28,7 +28,11 @@ jobs:

- name: Build and push
run: |
BUILD_ID=$(gcloud builds submit --tag ${{ env.IMAGE }} --project ${{ env.PROJECT_ID }} --async --format='value(id)')
BUILD_ID=$(gcloud builds submit \
--config=cloudbuild.yml \
--project ${{ env.PROJECT_ID }} \
--async \
--format='value(id)' .)
echo "Waiting for build $BUILD_ID..."
while true; do
STATUS=$(gcloud builds describe $BUILD_ID --project ${{ env.PROJECT_ID }} --format='value(status)' 2>/dev/null)
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Tests
on:
push:
branches: [main, dev]
pull_request:
branches: [main]

Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ RUN groupadd --system appuser && useradd --system --gid appuser appuser

WORKDIR /app

# Layer 1: playwright system deps (rarely changes)
RUN npx playwright install --with-deps chromium

# Layer 2: npm dependencies (changes when package.json changes)
COPY package.json yarn.lock* package-lock.json* ./
RUN npm install --production --ignore-scripts

RUN npx playwright install --with-deps chromium

# Layer 3: application code (changes every deploy)
COPY . .
RUN chown -R appuser:appuser /app

Expand Down
28 changes: 0 additions & 28 deletions cloudbuild.yaml

This file was deleted.

6 changes: 6 additions & 0 deletions cloudbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
steps:
- name: gcr.io/kaniko-project/executor:latest
args:
- --destination=gcr.io/$PROJECT_ID/casecomp-api:latest
- --cache=true
- --cache-ttl=168h
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"test:live": "API_URL=https://api.casecomp.xyz node test/api-test.js",
"scan": "node scan.js",
"psa": "node scripts/psa-report.js",
"deploy": "gcloud builds submit --tag gcr.io/casecomp-495718/cardscrapebot --project casecomp-495718 && gcloud run deploy cardscrapebot --image gcr.io/casecomp-495718/cardscrapebot --region asia-south1 --project casecomp-495718 --port 3000 --allow-unauthenticated",
"deploy": "gcloud builds submit --config=cloudbuild.yml --project casecomp-495718 && gcloud run deploy cardscrapebot --image gcr.io/casecomp-495718/casecomp-api --region asia-south1 --project casecomp-495718 --port 3000 --allow-unauthenticated",
"playwright-install": "npx playwright install chromium"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ variable "domain" {
}

variable "container_image" {
default = "gcr.io/casecomp-495718/cardscrapebot"
default = "gcr.io/casecomp-495718/casecomp-api"
}

variable "alert_email" {
Expand Down
Loading