From 2fdf92694e2ca411cc2233498aeb513cf49ae936 Mon Sep 17 00:00:00 2001 From: Jay Qi Date: Thu, 8 Aug 2024 22:05:16 -0400 Subject: [PATCH] Fix dockerfiles --- Makefile | 15 ++++--- runtime/Dockerfile | 17 ++++++-- runtime/Dockerfile-lock | 14 ++----- runtime/pixi.lock | 88 +++++++++++++++++++++-------------------- 4 files changed, 68 insertions(+), 66 deletions(-) diff --git a/Makefile b/Makefile index 293f9ff..6fd50b5 100644 --- a/Makefile +++ b/Makefile @@ -120,15 +120,14 @@ build: ## Updates runtime environment lockfile using Docker update-lockfile: @echo Generating the lockfile for CPU and GPU within Docker - cd runtime && \ - docker build . \ - --file Dockerfile-lock \ - --build-arg CPU_OR_GPU=${CPU_OR_GPU} \ + docker build runtime \ + --file runtime/Dockerfile-lock \ --tag pixi-lock:local - @echo Copying lockfile to host - docker create --name dummy pixi-lock:local - docker cp dummy:/tmp/pixi.lock runtime/pixi.lock - docker rm -f dummy + @echo Running lock container + docker run \ + --mount type=bind,source="$(shell pwd)"/runtime,target=/tmp \ + --rm \ + pixi-lock:local ## Ensures that your locally built image can import all the Python packages successfully when it runs test-container: _check_image _echo_image _submission_write_perms diff --git a/runtime/Dockerfile b/runtime/Dockerfile index 1dc98af..e0ae1ad 100644 --- a/runtime/Dockerfile +++ b/runtime/Dockerfile @@ -10,6 +10,15 @@ ENV DEBIAN_FRONTEND=noninteractive \ PYTHONUNBUFFERED=1 \ SHELL=/bin/bash +# Create user andset permissions +ENV RUNTIME_USER=runtimeuser +ENV RUNTIME_UID=1000 +ENV RUNTIME_GID=1000 + +RUN echo "Creating ${RUNTIME_USER} user..." \ + && groupadd --gid ${RUNTIME_UID} ${RUNTIME_USER} \ + && useradd --create-home --gid ${RUNTIME_UID} --no-log-init --uid ${RUNTIME_UID} ${RUNTIME_USER} + COPY apt.txt apt.txt RUN apt-get update --fix-missing \ && apt-get install -y apt-utils 2> /dev/null \ @@ -17,18 +26,18 @@ RUN apt-get update --fix-missing \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /apt.txt -COPY --chown=$MAMBA_USER:$MAMBA_USER pixi.lock /tmp/pixi.lock -COPY --chown=$MAMBA_USER:$MAMBA_USER pixi.toml /tmp/pixi.toml +COPY --chown=$RUNTIME_USER:$RUNTIME_USER pixi.lock /tmp/pixi.lock +COPY --chown=$RUNTIME_USER:$RUNTIME_USER pixi.toml /tmp/pixi.toml RUN pixi install --manifest-path /tmp/pixi.toml -e ${CPU_OR_GPU} && \ pixi clean --manifest-path /tmp/pixi.toml -e ${CPU_OR_GPU} RUN mkdir /code_execution -RUN chown -R ${MAMBA_USER}:${MAMBA_USER} /code_execution +RUN chown -R ${RUNTIME_USER}:${RUNTIME_USER} /code_execution COPY tests /code_execution/tests COPY entrypoint.sh /entrypoint.sh WORKDIR /code_execution -USER ${MAMBA_USER} +USER ${RUNTIME_USER} CMD ["bash", "/entrypoint.sh"] diff --git a/runtime/Dockerfile-lock b/runtime/Dockerfile-lock index d133a82..48e36a7 100644 --- a/runtime/Dockerfile-lock +++ b/runtime/Dockerfile-lock @@ -2,15 +2,7 @@ FROM ghcr.io/prefix-dev/pixi:0.26.1-bookworm-slim USER root -ARG CPU_OR_GPU=gpu - -ENV DEBIAN_FRONTEND=noninteractive \ - LANG=C.UTF-8 \ - LC_ALL=C.UTF-8 \ - PYTHONUNBUFFERED=1 \ - SHELL=/bin/bash - -COPY --chown=$MAMBA_USER:$MAMBA_USER pixi.lock /tmp/pixi.lock -COPY --chown=$MAMBA_USER:$MAMBA_USER pixi.toml /tmp/pixi.toml -RUN pixi tree --manifest-path /tmp/pixi.toml --platform linux-64 +RUN mkdir -p /tmp +WORKDIR /tmp +ENTRYPOINT ["pixi", "tree", "--manifest-path", "pixi.toml", "--platform", "linux-64", "-v"] diff --git a/runtime/pixi.lock b/runtime/pixi.lock index 998272a..98a45da 100644 --- a/runtime/pixi.lock +++ b/runtime/pixi.lock @@ -18,7 +18,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/aiosignal-1.3.1-pyhd8ed1ab_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/astunparse-1.6.3-pyhd8ed1ab_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/async-timeout-4.0.3-pyhd8ed1ab_0.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/attrs-24.1.0-pyh71513ae_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/attrs-24.2.0-pyh71513ae_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aws-c-auth-0.7.3-h28f7589_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aws-c-cal-0.6.1-hc309b26_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aws-c-common-0.9.0-hd590300_0.conda @@ -44,7 +44,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/cachetools-5.4.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/catalogue-2.0.10-py310hff52083_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/certifi-2024.7.4-pyhd8ed1ab_0.conda - - conda: https://conda.anaconda.org/conda-forge/linux-64/cffi-1.16.0-py310h2fee648_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cffi-1.17.0-py310h2fdcea3_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/charset-normalizer-3.3.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/click-8.1.7-unix_pyh707e725_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/cloudpathlib-0.16.0-pyhd8ed1ab_0.conda @@ -74,7 +74,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/gmp-6.3.0-hac33072_2.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/gmpy2-2.1.5-py310hc7909c9_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/google-api-core-2.19.1-pyhd8ed1ab_0.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/google-auth-2.32.0-pyhff2d567_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/google-auth-2.33.0-pyhff2d567_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/google-auth-oauthlib-1.0.0-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/google-pasta-0.2.0-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/googleapis-common-protos-1.63.2-pyhd8ed1ab_0.conda @@ -211,7 +211,7 @@ environments: - conda: https://conda.anaconda.org/pytorch/noarch/pytorch-mutex-1.0-cpu.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/pytz-2024.1-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyu2f-0.1.5-pyhd8ed1ab_0.tar.bz2 - - conda: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.1-py310h2372a71_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.2-py310h5b4e0ec_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/ray-core-2.8.1-py310h2ca9b2b_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/ray-default-2.8.1-py310ha1e06c9_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/rdma-core-28.9-h59595ed_1.conda @@ -222,7 +222,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/requests-2.32.3-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/requests-oauthlib-2.0.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/rich-13.7.1-pyhd8ed1ab_0.conda - - conda: https://conda.anaconda.org/conda-forge/linux-64/rpds-py-0.19.1-py310h42e942d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/rpds-py-0.20.0-py310h42e942d_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/rsa-4.9-pyhd8ed1ab_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/linux-64/s2n-1.3.49-h06160fa_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/sacremoses-0.0.53-pyhd8ed1ab_0.tar.bz2 @@ -305,7 +305,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/aiosignal-1.3.1-pyhd8ed1ab_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/astunparse-1.6.3-pyhd8ed1ab_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/async-timeout-4.0.3-pyhd8ed1ab_0.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/attrs-24.1.0-pyh71513ae_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/attrs-24.2.0-pyh71513ae_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aws-c-auth-0.7.3-h28f7589_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aws-c-cal-0.6.1-hc309b26_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/aws-c-common-0.9.0-hd590300_0.conda @@ -331,7 +331,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/cachetools-5.4.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/catalogue-2.0.10-py310hff52083_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/certifi-2024.7.4-pyhd8ed1ab_0.conda - - conda: https://conda.anaconda.org/conda-forge/linux-64/cffi-1.16.0-py310h2fee648_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cffi-1.17.0-py310h2fdcea3_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/charset-normalizer-3.3.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/click-8.1.7-unix_pyh707e725_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/cloudpathlib-0.16.0-pyhd8ed1ab_0.conda @@ -371,7 +371,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/gmp-6.3.0-hac33072_2.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/gmpy2-2.1.5-py310hc7909c9_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/google-api-core-2.19.1-pyhd8ed1ab_0.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/google-auth-2.32.0-pyhff2d567_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/google-auth-2.33.0-pyhff2d567_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/google-auth-oauthlib-1.0.0-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/google-pasta-0.2.0-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/googleapis-common-protos-1.63.2-pyhd8ed1ab_0.conda @@ -518,7 +518,7 @@ environments: - conda: https://conda.anaconda.org/pytorch/noarch/pytorch-mutex-1.0-cuda.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/pytz-2024.1-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyu2f-0.1.5-pyhd8ed1ab_0.tar.bz2 - - conda: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.1-py310h2372a71_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.2-py310h5b4e0ec_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/ray-core-2.8.1-py310h2ca9b2b_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/ray-default-2.8.1-py310ha1e06c9_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/rdma-core-28.9-h59595ed_1.conda @@ -529,7 +529,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/requests-2.32.3-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/requests-oauthlib-2.0.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/rich-13.7.1-pyhd8ed1ab_0.conda - - conda: https://conda.anaconda.org/conda-forge/linux-64/rpds-py-0.19.1-py310h42e942d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/rpds-py-0.20.0-py310h42e942d_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/rsa-4.9-pyhd8ed1ab_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/linux-64/s2n-1.3.49-h06160fa_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/sacremoses-0.0.53-pyhd8ed1ab_0.tar.bz2 @@ -755,19 +755,19 @@ packages: timestamp: 1691763717537 - kind: conda name: attrs - version: 24.1.0 + version: 24.2.0 build: pyh71513ae_0 subdir: noarch noarch: python - url: https://conda.anaconda.org/conda-forge/noarch/attrs-24.1.0-pyh71513ae_0.conda - sha256: fe47984d3e453c763ff7b4b854837f0bf4fe233a2cd162be82504a19c4ec1457 - md5: 1f2d47df5c1127313066a8651fe9288d + url: https://conda.anaconda.org/conda-forge/noarch/attrs-24.2.0-pyh71513ae_0.conda + sha256: 28dba85a7e0f7fb57d7315e13f603d1e41b83c5b88aa2a602596b52c833a2ff8 + md5: 6732fa52eb8e66e5afeb32db8701a791 depends: - python >=3.7 license: MIT license_family: MIT - size: 56327 - timestamp: 1722715555247 + size: 56048 + timestamp: 1722977241383 - kind: conda name: aws-c-auth version: 0.7.3 @@ -1198,13 +1198,14 @@ packages: timestamp: 1720458053074 - kind: conda name: cffi - version: 1.16.0 - build: py310h2fee648_0 + version: 1.17.0 + build: py310h2fdcea3_0 subdir: linux-64 - url: https://conda.anaconda.org/conda-forge/linux-64/cffi-1.16.0-py310h2fee648_0.conda - sha256: 007e7f69ab45553b7bf11f2c1b8d3f3a13fd42997266a0d57795f41c7d38df36 - md5: 45846a970e71ac98fd327da5d40a0a2c + url: https://conda.anaconda.org/conda-forge/linux-64/cffi-1.17.0-py310h2fdcea3_0.conda + sha256: 082a0c2aee928cdc4fc41320a61a530d10b4c13c886f0de8f6d57e7daacfc1b1 + md5: 6ac912f6208a15d35955ab73a4e5efda depends: + - __glibc >=2.17,<3.0.a0 - libffi >=3.4,<4.0a0 - libgcc-ng >=12 - pycparser @@ -1212,8 +1213,8 @@ packages: - python_abi 3.10.* *_cp310 license: MIT license_family: MIT - size: 241339 - timestamp: 1696001848492 + size: 242409 + timestamp: 1723018481932 - kind: conda name: charset-normalizer version: 3.3.2 @@ -1882,13 +1883,13 @@ packages: timestamp: 1719307111090 - kind: conda name: google-auth - version: 2.32.0 + version: 2.33.0 build: pyhff2d567_0 subdir: noarch noarch: python - url: https://conda.anaconda.org/conda-forge/noarch/google-auth-2.32.0-pyhff2d567_0.conda - sha256: ed1ba42553e213245f6f5f8cb417996525f10ba7c88b5819de3f521e110bbf5a - md5: 985a17f06e617d6c8dab825a39a39d00 + url: https://conda.anaconda.org/conda-forge/noarch/google-auth-2.33.0-pyhff2d567_0.conda + sha256: 4898e99b92a16b4900696dad12d7b201e6940f6cd20fabfe8f0a059fef9f5b87 + md5: 5a750d3f2f4bfb378322dda0d8a02018 depends: - aiohttp >=3.6.2,<4.0.0 - cachetools >=2.0.0,<6.0 @@ -1901,8 +1902,8 @@ packages: - rsa >=3.1.4,<5 license: Apache-2.0 license_family: Apache - size: 110849 - timestamp: 1720518449305 + size: 111747 + timestamp: 1723018880178 - kind: conda name: google-auth-oauthlib version: 1.0.0 @@ -4443,22 +4444,22 @@ packages: timestamp: 1604249020971 - kind: conda name: pyyaml - version: 6.0.1 - build: py310h2372a71_1 - build_number: 1 + version: 6.0.2 + build: py310h5b4e0ec_0 subdir: linux-64 - url: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.1-py310h2372a71_1.conda - sha256: aa78ccddb0a75fa722f0f0eb3537c73ee1219c9dd46cea99d6b9eebfdd780f3d - md5: bb010e368de4940771368bc3dc4c63e7 + url: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.2-py310h5b4e0ec_0.conda + sha256: e7b3d6ee96fedc29b49a3705401765743082e79ea9f6359fdc6d3a2245fd6747 + md5: ad8de7b4ac482217959cc1e8fe0cc56d depends: + - __glibc >=2.17,<3.0.a0 - libgcc-ng >=12 - python >=3.10,<3.11.0a0 - python_abi 3.10.* *_cp310 - yaml >=0.2.5,<0.3.0a0 license: MIT license_family: MIT - size: 170627 - timestamp: 1695373587159 + size: 181235 + timestamp: 1723018382019 - kind: conda name: ray-core version: 2.8.1 @@ -4665,12 +4666,12 @@ packages: timestamp: 1709150578093 - kind: conda name: rpds-py - version: 0.19.1 + version: 0.20.0 build: py310h42e942d_0 subdir: linux-64 - url: https://conda.anaconda.org/conda-forge/linux-64/rpds-py-0.19.1-py310h42e942d_0.conda - sha256: bded054638611b028d354b581d70e4353be5f4bd43a331c2d9bb829f80a18f1b - md5: e475e081b969944abf635b7484b8661e + url: https://conda.anaconda.org/conda-forge/linux-64/rpds-py-0.20.0-py310h42e942d_0.conda + sha256: 77a800f5a37bcaefad09b46b19f2d17357bc46eff7514f8db570c885e9369477 + md5: 825361e63187e65a9da05a8b4274a0e1 depends: - __glibc >=2.17,<3.0.a0 - libgcc-ng >=12 @@ -4680,8 +4681,8 @@ packages: - __glibc >=2.17 license: MIT license_family: MIT - size: 331102 - timestamp: 1721861153079 + size: 334195 + timestamp: 1723039241464 - kind: conda name: rsa version: '4.9' @@ -4749,6 +4750,7 @@ packages: constrains: - __glibc >=2.17 license: Apache-2.0 + license_family: APACHE size: 400960 timestamp: 1722937971905 - kind: conda