|
| 1 | +# First, specify the base Docker image. |
| 2 | +# You can see the Docker images from Apify at https://hub.docker.com/r/apify/. |
| 3 | +# You can also use any other image from Docker Hub. |
| 4 | +FROM apify/actor-python:3.13 |
| 5 | + |
| 6 | +# Second, copy just requirements.txt into the Actor image, |
| 7 | +# since it should be the only file that affects the dependency installation in the next step, |
| 8 | +# in order to speed up the build. |
| 9 | +COPY requirements.txt ./ |
| 10 | + |
| 11 | +# Install the packages specified in requirements.txt, |
| 12 | +# print the installed Python version, pip version, |
| 13 | +# and all installed packages with their versions for debugging. |
| 14 | +RUN echo "Python version:" \ |
| 15 | + && python --version \ |
| 16 | + && echo "Pip version:" \ |
| 17 | + && pip --version \ |
| 18 | + && echo "Installing dependencies:" \ |
| 19 | + && pip install -r requirements.txt \ |
| 20 | + && echo "All installed Python packages:" \ |
| 21 | + && pip freeze |
| 22 | + |
| 23 | +# Next, copy the remaining files and directories with the source code. |
| 24 | +# Since we do this after installing the dependencies, quick builds will be really fast |
| 25 | +# for most source file changes. |
| 26 | +COPY . ./ |
| 27 | + |
| 28 | +# Use compileall to ensure the runnability of the Actor Python code. |
| 29 | +RUN python3 -m compileall -q src/ |
| 30 | + |
| 31 | +# Specify how to launch the source code of your Actor. |
| 32 | +# By default, the "python3 -m ." command is run. |
| 33 | +CMD ["python3", "-m", "src"] |
0 commit comments