Open rsyring opened 2 weeks ago
Hi @rsyring ! Copilot passes all the relevant arguments you specify under image
to docker build
. Would you be able to run docker history
of your app
's image to see if it was built via. docker build --target celery
?
I also wonder if BuildKit was enabled when the images are being built. I am not exactly sure how this would be relevant to the issue you have - I just have a gut feeling that it might 💭
and thanks a bunch for catching the malware bot for us! I've hidden their comment. ❤️
@Lou1415926 hi there. Thanks for jumping in here. Here is the result of docker history
where the image id is the latest image pushed to the web ECR repo:
❯ docker history 58b460adfabf
IMAGE CREATED CREATED BY SIZE COMMENT
58b460adfabf 14 hours ago COPY deploy/climate-config.py /etc/climate-c… 3.9kB buildkit.dockerfile.v0
<missing> 14 hours ago CMD [] 0B buildkit.dockerfile.v0
<missing> 14 hours ago ENTRYPOINT ["/var/venv/bin/granian" "--host"… 0B buildkit.dockerfile.v0
<missing> 14 hours ago COPY /app/vite/dist /app/vite/dist # buildkit 958kB buildkit.dockerfile.v0
<missing> 14 hours ago ENV PATH=/var/venv/bin/:/usr/local/sbin:/usr… 0B buildkit.dockerfile.v0
<missing> 14 hours ago COPY src/tasks_lib.py src/tasks_lib.py # bui… 680B buildkit.dockerfile.v0
<missing> 14 hours ago COPY src/wsgi.py src/wsgi.py # buildkit 400B buildkit.dockerfile.v0
<missing> 14 hours ago RUN /bin/sh -c $UV_INSTALL -e . # buildkit 62.5kB buildkit.dockerfile.v0
<missing> 14 hours ago COPY src/climate src/climate # buildkit 23.2MB buildkit.dockerfile.v0
<missing> 15 hours ago RUN /bin/sh -c $UV_INSTALL -r requirements/d… 219MB buildkit.dockerfile.v0
<missing> 15 hours ago COPY pyproject.toml hatch.toml . # buildkit 1.04kB buildkit.dockerfile.v0
<missing> 15 hours ago COPY requirements requirements # buildkit 370kB buildkit.dockerfile.v0
<missing> 15 hours ago RUN /bin/sh -c $UV_INSTALL /tmp/wheels/* # b… 2.36MB buildkit.dockerfile.v0
<missing> 15 hours ago COPY /tmp/wheels /tmp/wheels # buildkit 716kB buildkit.dockerfile.v0
<missing> 23 hours ago WORKDIR /app 0B buildkit.dockerfile.v0
<missing> 23 hours ago ENV UV_INSTALL=mise exec -- uv pip install -… 0B buildkit.dockerfile.v0
<missing> 23 hours ago RUN /bin/sh -c mise install python && mi… 135MB buildkit.dockerfile.v0
<missing> 23 hours ago COPY mise.toml deploy/mise.local.toml . # bu… 331B buildkit.dockerfile.v0
<missing> 23 hours ago ENV MISE_TRUSTED_CONFIG_PATHS=/app 0B buildkit.dockerfile.v0
<missing> 23 hours ago WORKDIR /app 0B buildkit.dockerfile.v0
<missing> 23 hours ago RUN /bin/sh -c apt update -y && apt inst… 114MB buildkit.dockerfile.v0
I also saw this same behavior. Right now I'm working around it by having multiple mostly-identical Dockerfiles.
Maybe related to: https://github.com/aws/copilot-cli/issues/1943
Description:
I have a Flask based Python application that can be ran as a web service and also as a celery worker. So, two services from the same codebase. Since the manifest's
image
tag takes atarget
setting, I assumed I could setup my LB web service and the Backend Service (celery) to share the same Dockerfile:Manifests:
Initially, only the web manifest existed and I deployed that service successfully multiple times. I then added the celery service and the celery serivce also deployed successfully.
I went back and did some work on the web service source code and deployed it again. It started failing it's health checks. Turns out that the web service was now running the app with the celery
entrypoint
.I was only able to resolve this by commenting out the celery build target in the Dockerfile so that the last target was
app
.Details:
copilot: v 1.34.1 OS: Ubuntu 24.04 Docker: 27.1.2 Manifests: LB Web Service & Backend Service AWS Region: us-east-2 Deploy command:
copilot svc deploy --name [celery|web]
Expectation & Result
Expectation: the web image would have the entrypoint of the
app
target in the Dockerfile.Result: the web image had the entrypoint of the celery target (although, I think it wasn't that target in particular but just the last target in the Dockerfile.
Debugging:
Evidence that the image is not being built with the correct entrypoint can be found in image history in that ECR repo:
The difference between the entrypoint configuration in the image was whether or not the Dockerfile celery build target was active or commented out.
I was also able to run the two different build targets without issue in docker compose:
Workaround
Use the same build target,
app
, which also happens to be the last target in the Dockerfile.Set the entrypoint in the Dockerfile for the web service. In the celery manifest, change the entrypoint.
This works but is not ideal b/c now I need to specify the entrypoint for celery in both the manifest and my docker compose file. I prefer to have it all in the Dockerfile so that there isn't room for "drift" between my local testing of the images and what they will be when they are running in AWS.