-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathDockerfile
executable file
·48 lines (36 loc) · 1.21 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
FROM ghcr.io/prefix-dev/pixi:0.36.0-jammy-cuda-11.8.0
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
# Create user andset permissions
ENV RUNTIME_USER=runtimeuser
ENV RUNTIME_UID=1000
ENV RUNTIME_GID=1000
ENV CPU_OR_GPU=$CPU_OR_GPU
RUN echo "Creating ${RUNTIME_USER} user..." \
&& groupadd --gid ${RUNTIME_GID} ${RUNTIME_USER} \
&& useradd --create-home --gid ${RUNTIME_GID} --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 \
&& xargs -a apt.txt apt-get install -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /apt.txt
# Set up code execution working directory
RUN mkdir /code_execution
RUN chown -R ${RUNTIME_USER}:${RUNTIME_USER} /code_execution
WORKDIR /code_execution
# Switch to runtime user
USER ${RUNTIME_USER}
COPY pixi.lock ./pixi.lock
COPY pixi.toml ./pixi.toml
RUN pixi install -e ${CPU_OR_GPU} --frozen \
&& pixi clean cache --yes \
&& pixi info
COPY entrypoint.sh /entrypoint.sh
COPY --chown=${RUNTIME_USER}:${RUNTIME_USER} tests ./tests
CMD ["bash", "/entrypoint.sh"]