Skip to content

Commit

Permalink
Merge pull request #2 from bits-bsc-cs/sattwyk/bot
Browse files Browse the repository at this point in the history
fix ci
  • Loading branch information
sattwyk authored Nov 5, 2024
2 parents 35384a8 + 9df48b3 commit 3e1fbf6
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 52 deletions.
48 changes: 0 additions & 48 deletions .github/workflows/deploy.yaml

This file was deleted.

8 changes: 4 additions & 4 deletions bot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Use the official Python image as the base image
FROM python:3.10-slim-bookworm AS base

# Install uv
# Copy uv binaries
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# Set environment variables
Expand All @@ -15,17 +15,17 @@ ENV PORT=8080
# Set the working directory
WORKDIR /app

# Copy only the necessary files for dependency installation
# Copy dependency files for installation
COPY pyproject.toml uv.lock ./

# Install dependencies
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install --system -r pyproject.toml

# Copy the rest of the application code
# Copy the main application file
COPY bot.py ./

# Compile bytecode
# Compile bytecode (this step might be redundant if UV_COMPILE_BYTECODE is set)
RUN python -m compileall .

# Expose the port the app runs on
Expand Down
35 changes: 35 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
steps:
# Build the Docker image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/discord-bot:$COMMIT_SHA'
- '-f'
- 'bot/Dockerfile'
- 'bot'
env:
- 'DOCKER_BUILDKIT=1'

# Push the image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'gcr.io/$PROJECT_ID/discord-bot:$COMMIT_SHA'

# Deploy to Cloud Run
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args:
- 'run'
- 'deploy'
- 'discord-bot'
- '--image'
- 'gcr.io/$PROJECT_ID/discord-bot:$COMMIT_SHA'
- '--region'
- 'us-central1'
- '--platform'
- 'managed'

images:
- 'gcr.io/$PROJECT_ID/discord-bot:$COMMIT_SHA'

0 comments on commit 3e1fbf6

Please sign in to comment.