🐋 feat: docker base image

This commit is contained in:
Florian Hönicke
2023-05-04 11:23:00 +02:00
parent 0854e9441c
commit 3204d893e1
6 changed files with 64 additions and 74 deletions

View File

@@ -1,4 +1,4 @@
DOCKER_BASE_IMAGE_VERSION = '0.0.1'
DOCKER_BASE_IMAGE_VERSION = '0.0.2'
EXECUTOR_FILE_NAME = '__init__.py'
IMPLEMENTATION_FILE_NAME = 'microservice.py'

View File

@@ -17,7 +17,7 @@ from src.apis.pypi import is_package_on_pypi, get_latest_package_version, clean_
from src.constants import FILE_AND_TAG_PAIRS, NUM_IMPLEMENTATION_STRATEGIES, MAX_DEBUGGING_ITERATIONS, \
BLACKLISTED_PACKAGES, EXECUTOR_FILE_NAME, TEST_EXECUTOR_FILE_NAME, TEST_EXECUTOR_FILE_TAG, \
REQUIREMENTS_FILE_NAME, REQUIREMENTS_FILE_TAG, DOCKER_FILE_NAME, IMPLEMENTATION_FILE_NAME, \
IMPLEMENTATION_FILE_TAG, LANGUAGE_PACKAGES, UNNECESSARY_PACKAGES
IMPLEMENTATION_FILE_TAG, LANGUAGE_PACKAGES, UNNECESSARY_PACKAGES, DOCKER_BASE_IMAGE_VERSION
from src.options.generate.templates_system import system_task_iteration, system_task_introduction, system_test_iteration
from src.options.generate.templates_user import template_generate_microservice_name, \
template_generate_possible_packages, \
@@ -211,7 +211,7 @@ metas:
encoding='utf-8') as f:
docker_file_template_lines = f.readlines()
docker_file_template_lines = [
line.replace('{{apt_get_packages}}', '')
line.replace('{{APT_GET_PACKAGES}}', '').replace('{{DOCKER_BASE_IMAGE_VERSION}}', DOCKER_BASE_IMAGE_VERSION)
for line in docker_file_template_lines
]
docker_file_content = '\n'.join(docker_file_template_lines)
@@ -231,8 +231,8 @@ metas:
packages = ' '.join(json.loads(json_string)['packages'])
docker_file_template = self.read_docker_template()
return {DOCKER_FILE_NAME: docker_file_template.replace('{{apt_get_packages}}', '{apt_get_packages}').format(
apt_get_packages=packages)}
return {DOCKER_FILE_NAME: docker_file_template.replace('{{APT_GET_PACKAGES}}', '{APT_GET_PACKAGES}').replace('{{DOCKER_BASE_IMAGE_VERSION}}', DOCKER_BASE_IMAGE_VERSION).format(
APT_GET_PACKAGES=packages)}
def parse_result_fn_requirements(self, content_raw: str):
content_parsed = self.extract_content_from_result(content_raw, 'requirements.txt', match_single_block=True)

View File

@@ -1,8 +1,6 @@
FROM jinaai/gpt-dev:latest
# update pip
RUN pip install --upgrade pip
FROM jinaai/gpt-dev:{{DOCKER_BASE_IMAGE_VERSION}}
RUN apt-get install --no-install-recommends -y {{apt_get_packages}}
RUN apt-get install --no-install-recommends -y {{APT_GET_PACKAGES}}
## install requirements for the executor
COPY requirements.txt .

View File

@@ -170,7 +170,7 @@ template_generate_apt_get_install = PromptTemplate.from_template(
{docker_file_wrapped}
Name all packages which need to be installed via `apt-get install` in above Dockerfile (`{{apt_get_packages}}`) for the following requirements.txt file:
Name all packages which need to be installed via `apt-get install` in above Dockerfile (`{{APT_GET_PACKAGES}}`) for the following requirements.txt file:
{requirements_file_wrapped}
@@ -178,7 +178,7 @@ Note that you must not list apt-get packages that are already installed in the D
Note that openai does not require any apt-get packages.
Note that you are only allowed to list packages where you are highly confident that they are really needed.
Note that you can assume that the standard python packages are already installed.
Output the packages that need to me placed at {{apt_get_packages}} as json in the following format:
Output the packages that need to me placed at {{APT_GET_PACKAGES}} as json in the following format:
**apt-get-packages.json**
```json
{{"packages": ["<package1>", "<package2>"]}}
@@ -275,7 +275,7 @@ Here is the summary of the error that occurred:
{summarized_error}
To solve this error, you should determine the list of packages that need to be installed via `apt-get install` in the Dockerfile.
Output the apt-get packages that need to be placed at {{apt_get_packages}} as json in the following format:
Output the apt-get packages that need to be placed at {{APT_GET_PACKAGES}} as json in the following format:
**apt-get-packages.json**
```json
{{"packages": ["<package1>", "<package2>"]}}