-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: when building two services from the same Dockerfile, target seems to be ignored #5921
Comments
Hi @rsyring ! Copilot passes all the relevant arguments you specify under 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
|
I also saw this same behavior. Right now I'm working around it by having multiple mostly-identical Dockerfiles. |
Maybe related to: #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.
The text was updated successfully, but these errors were encountered: