Reputation: 877
I created a sever on google cloud and created a miniconda environment to test my API and worked. But to do the "Deploy to cloud run" did not. There is a way to do the deploy by dockerfile on an existing conda environment on google cloud? If yes, please, where I find a tutorial or an example?
Or will be something like this:
FROM python:3.8
USER myuser #an existing user
WORKDIR /home/myuser
RUN conda activate venv # an existing miniconda environment
ENV PATH="/home/myuser/.local/bin:${PATH}"
COPY --chown=myuser:myuser . .
CMD ["python", "main.py"]
Upvotes: 0
Views: 286
Reputation: 76809
There might be an existing environment in some VM, but not in this container. And a Dockerfile
might not be enough, but this may require a cloudbuild.yaml
, where the image
needs Python 3.8 and miniconda installed. In case the default Python 3.8 image does not provide miniconda, you'll have to build a custom image first - which then can be used. I mean, one can use the Dockerfile
to build the custom Docker image and cloudbuild.yaml
to cloud build/run it. In order to run commands post-deploy (as it may be required), the container needs to know about them.
Besides, setting up a per-user environment inside a container is generally strange,
because system services usually do not care much about a per-user environment.
Upvotes: 1