I have a website built with pelican site generator, and I would like to dockerize it and deploy it to GCP using Cloud Run. I'm not super familiar with docker and can't figure out what to use as my ENTRYPOINT. So far I have this in my Dockerfile:
FROM python:3.10-slim-bullseye AS pelican
EXPOSE 80
RUN apt update && apt install -y --no-install-recommends git \
make \
&& rm -rf /var/lib/apt/lists/*
ADD requirements.txt requirements.txt
RUN python -m pip install --no-cache-dir -r requirements.txt
# prevent writing .pyc files
ENV PYTHONDONTWRITEBYTECODE 1
# bust the cache
WORKDIR /website
COPY . /website/
RUN pelican
FROM httpd:2.4.52-alpine
COPY --from=pelican /website/output/ /usr/local/apache2/htdocs/
And when I build and run with docker run -d -p 8080:80 website my website is running alright at localhost:8080. However when I deploy this to GCP Cloud Run, I get this error
terminated: Application failed to start: failed to resolve binary path: error finding executable "docker run -d -p 8080:80 website" in PATH [/usr/local/apache2/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin]: no such file or directory
And I've put docker run -d -p 8080:80 website as my container arguments.
I've followed steps outlined here https://cloud.google.com/build/docs/build-push-docker-image for building the image, deploy it to Artifact Registry, but I wasn't able to run the image or deploy it to cloud run. There are also more generic error messages like
"efault STARTUP TCP probe failed 1 time consecutively for container "xx-image-1" on port 8080. The instance was not started.
Not sure how to proceed from here. Thanks in advance!
I fixed this!
In my Dockerfile, I exposed port 80 instead of 8080, and when I run it locally I have
docker run -d -p 8080:80 websiteSo in the Cloud Run I should have used port 80, instead of the default 8080. I edited it here:
FYI I also need to enable upload to artifact registry with the following before I could upload the container from commandline.