0

I have create a docker container like this:

FROM python:3.7-slim-buster
COPY . /opt/
WORKDIR /opt/
RUN pip install -r requirements.txt
EXPOSE 8080
CMD ["python3", "/opt/myscript.py"]

And I call my Fargate container from Lambda like this:

response = client.run_task(
    cluster="my-cluster",
    launchType = 'FARGATE',
    taskDefinition= "my-definition",
    networkConfiguration={
        'awsvpcConfiguration': {
            'subnets': ['my-subnet'],
            }
        },

Its working fine. But now I want to be able to run two different python scripts dependent on which lambda function I am calling Fargate from, so e.g.

Lambda function 1: -> ["python3", "/opt/myscript.py"]

Lambda function 2: -> ["python3", "/opt/my_other_script.py"]

How would I achieve something like that?

smallbirds
  • 877
  • 12
  • 35

1 Answers1

1

CMD ["/opt/myscript.py"]

ENTRYPOINT ["python"]

In your dockerfile you can have the equivalent of the above then use overrides/containerOverrides with the run task command in boto