diff --git a/src/crawlee/project_template/{{cookiecutter.project_name}}/.dockerignore b/src/crawlee/project_template/{{cookiecutter.project_name}}/.dockerignore index 1d17dae13b..88ea270890 100644 --- a/src/crawlee/project_template/{{cookiecutter.project_name}}/.dockerignore +++ b/src/crawlee/project_template/{{cookiecutter.project_name}}/.dockerignore @@ -1 +1,2 @@ .venv +storage diff --git a/src/crawlee/project_template/{{cookiecutter.project_name}}/Dockerfile b/src/crawlee/project_template/{{cookiecutter.project_name}}/Dockerfile index dda254f8f0..71444cc24f 100644 --- a/src/crawlee/project_template/{{cookiecutter.project_name}}/Dockerfile +++ b/src/crawlee/project_template/{{cookiecutter.project_name}}/Dockerfile @@ -2,16 +2,14 @@ # You can see the Docker images from Apify at https://hub.docker.com/r/apify/. # You can also use any other image from Docker Hub. # % if cookiecutter.crawler_type == 'playwright' -FROM apify/actor-python-playwright:3.13 +FROM apify/actor-python-playwright:3.13-beta # % elif cookiecutter.crawler_type == 'playwright-camoufox' # Currently camoufox has issues installing on Python 3.13 -FROM apify/actor-python-playwright:3.12 +FROM apify/actor-python-playwright:3.12-beta # % else -FROM apify/actor-python:3.13 +FROM apify/actor-python:3.13-beta # % endif -RUN apt update && apt install -yq git && rm -rf /var/lib/apt/lists/* - # % if cookiecutter.package_manager == 'poetry' RUN pip install -U pip setuptools \ && pip install 'poetry<3' \ @@ -20,7 +18,7 @@ RUN pip install -U pip setuptools \ # Second, copy just poetry.lock and pyproject.toml into the Actor image, # since those should be the only files that affects the dependency install in the next step, # in order to speed up the build -COPY pyproject.toml poetry.lock ./ +COPY --chown=myuser:myuser pyproject.toml poetry.lock ./ # Install the dependencies RUN echo "Python version:" \ @@ -38,9 +36,7 @@ RUN echo "Python version:" \ RUN pip install -U pip setuptools \ && pip install 'uv<1' -ENV UV_PROJECT_ENVIRONMENT="/usr/local" - -COPY pyproject.toml uv.lock ./ +COPY --chown=myuser:myuser pyproject.toml uv.lock ./ RUN echo "Python version:" \ && python --version \ @@ -62,7 +58,7 @@ RUN pip install -U pip setuptools # Second, copy just requirements.txt into the Actor image, # since it should be the only file that affects the dependency install in the next step, # in order to speed up the build -COPY requirements.txt ./ +COPY --chown=myuser:myuser requirements.txt ./ # Install the dependencies RUN echo "Python version:" \ @@ -83,10 +79,10 @@ RUN echo "Python version:" \ # Next, copy the remaining files and directories with the source code. # Since we do this after installing the dependencies, quick build will be really fast # for most source file changes. -COPY . ./ +COPY --chown=myuser:myuser . ./ # Use compileall to ensure the runnability of the Actor Python code. -RUN python -m compileall -q . +RUN python -m compileall -q ./{{ cookiecutter.__package_name }} # % if cookiecutter.crawler_type == 'playwright-camoufox' # Fetch camoufox files that are always needed when using camoufox. diff --git a/src/crawlee/project_template/{{cookiecutter.project_name}}/pyproject.toml b/src/crawlee/project_template/{{cookiecutter.project_name}}/pyproject.toml index 5c2146104d..c12557cb75 100644 --- a/src/crawlee/project_template/{{cookiecutter.project_name}}/pyproject.toml +++ b/src/crawlee/project_template/{{cookiecutter.project_name}}/pyproject.toml @@ -19,7 +19,7 @@ authors = [ readme = "README.md" requires-python = ">=3.10,<4.0" dependencies = [ - "crawlee[{{ extras|join(',') }}]", + "crawlee[{{ extras|join(',') }}]==0.6.12", # % if cookiecutter.crawler_type == 'playwright-camoufox' "camoufox[geoip]~=0.4.5", # % endif diff --git a/tests/e2e/project_template/utils.py b/tests/e2e/project_template/utils.py index 685e8c45e8..2aecf07718 100644 --- a/tests/e2e/project_template/utils.py +++ b/tests/e2e/project_template/utils.py @@ -29,10 +29,10 @@ def _patch_crawlee_version_in_requirements_txt_based_project(project_path: Path, with requirements_path.open() as f: modified_lines = [] for line in f: - if 'crawlee' in line: - modified_lines.append(f'./{wheel_path.name}{crawlee_extras}\n') - else: - modified_lines.append(line) + # if 'crawlee' in line: + # modified_lines.append(f'./{wheel_path.name}{crawlee_extras}\n') + # else: + modified_lines.append(line) with requirements_path.open('w') as f: f.write(''.join(modified_lines)) @@ -42,13 +42,13 @@ def _patch_crawlee_version_in_requirements_txt_based_project(project_path: Path, modified_lines = [] for line in f: modified_lines.append(line) - if line.startswith('COPY requirements.txt ./'): + if line.startswith('COPY') and 'requirements.txt' in line: modified_lines.extend( [ - f'COPY {wheel_path.name} ./\n', + # f'COPY {wheel_path.name} ./\n', # If no crawlee version bump, pip might be lazy and take existing pre-installed crawlee version, # make sure that one is patched as well. - f'RUN pip install ./{wheel_path.name}{crawlee_extras} --force-reinstall\n', + # f'RUN pip install ./{wheel_path.name}{crawlee_extras} --force-reinstall\n', ] ) with dockerfile_path.open('w') as f: @@ -69,7 +69,7 @@ def _patch_crawlee_version_in_pyproject_toml_based_project(project_path: Path, w modified_lines = [] for line in f: modified_lines.append(line) - if line.startswith('COPY pyproject.toml'): + if line.startswith('COPY') and 'pyproject.toml' in line: if 'uv.lock' in line: package_manager = 'uv' elif 'poetry.lock' in line: @@ -90,12 +90,12 @@ def _patch_crawlee_version_in_pyproject_toml_based_project(project_path: Path, w # and so the absolute path(in the container) is generated when running `add` command in the container. modified_lines.extend( [ - f'COPY {wheel_path.name} ./\n', + # f'COPY {wheel_path.name} ./\n', # If no crawlee version bump, poetry might be lazy and take existing pre-installed crawlee # version, make sure that one is patched as well. - f'RUN pip install ./{wheel_path.name}{crawlee_extras} --force-reinstall\n', - f'RUN {package_manager} add ./{wheel_path.name}{crawlee_extras}\n', - f'RUN {package_manager} lock\n', + # f'RUN pip install ./{wheel_path.name}{crawlee_extras} --force-reinstall\n', + # f'RUN {package_manager} add ./{wheel_path.name}{crawlee_extras}\n', + # f'RUN {package_manager} lock\n', ] ) with dockerfile_path.open('w') as f: