Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Django + React in Cloud Run with CI/CD integration

Hi,

I am trying to up a django cloud run service with react as the frontend and django + django rest as the backend and api.

created a the Dockerfile with two parts

FROM node:lts-alpine AS react-build
..
RUN npm ci
RUN npm run build

FROM python:3.8-slim AS lean
...
CMD exec gunicorn
and then on the cloudbuild.yaml added procedure for npm packing
# step 1
- Dockerbuild (exec-wrapper)
# step 2
- Docker push to artifact registry
# step 3
- name: gcr.io/cloud-builders/npm
args:
- 'install'
dir: 'frontend'
id: 'Install npm packages'
# step 4
- name: gcr.io/cloud-builders/npm
args:
- 'run'
- 'build'
dir: 'frontend'
id: 'build frontend'

  but when I inspect the container, there were no build found.

Is there a way to fix these ? or should I try a different setup ?

Thank you

0 2 505
2 REPLIES 2

Hi @lcueto ,

Could you provide any error logs when trying to deploy using CI/CD integration? This would help us a lot to identify the issue you're dealing with.

Regards,
Marc

Hi @marcanthonyb ,

unfortunately there were no specific errors , and I found out that I just missed on how multistage Dockerfile works..
For reference:
I just added the following within the Dockerfile

COPY --from=react-build /source/path /destination/path

Thank you,

Leo