Skip to content

Commit

Permalink
Migrate plugins to cloudrun
Browse files Browse the repository at this point in the history
  • Loading branch information
thainguyensunya committed Nov 22, 2024
1 parent 440c93f commit 39d1eef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/gcp_plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Google Auth
id: auth
uses: 'google-github-actions/auth@v0'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- run: gcloud auth configure-docker
Expand All @@ -36,7 +36,7 @@ jobs:
docker push gcr.io/${{ vars.GCP_PROJECT_ID }}/${{ env.SERVICE }}
- name: Deploy to Cloud Run
id: deploy
uses: google-github-actions/deploy-cloudrun@v0
uses: google-github-actions/deploy-cloudrun@v2
with:
service: ${{ env.SERVICE }}
region: ${{ env.REGION }}
Expand Down
22 changes: 13 additions & 9 deletions plugins/example/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
FROM tiangolo/uvicorn-gunicorn:python3.11
FROM python:3.11 AS builder

RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y curl
RUN apt-get install unzip
RUN apt-get -y install python3
RUN apt-get -y install python3-pip
RUN apt-get -y install git
RUN apt-get -y install ffmpeg
ENV PATH="/opt/venv/bin:$PATH"
RUN python -m venv /opt/venv

COPY plugins/example/requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt

COPY plugins/example/ /app
FROM python:3.11-slim

WORKDIR /app
ENV PATH="/opt/venv/bin:$PATH"

RUN apt-get update && apt-get -y install ffmpeg curl unzip && rm -rf /var/lib/apt/lists/*

COPY --from=builder /opt/venv /opt/venv
COPY plugins/example/ .

EXPOSE 8080
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]

0 comments on commit 39d1eef

Please sign in to comment.