-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.artifact
44 lines (26 loc) · 1021 Bytes
/
Dockerfile.artifact
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
# ----- stage 1: build -----
FROM python:3.11 as build
# requirements section depends on pip vs conda, and presence of buildx
ENV PIP_PROGRESS_BAR off
RUN python -m venv /env
# make sure we install into the env
ENV PATH="/env/bin:$PATH"
COPY src/requirements.frozen.txt _wandb_bootstrap.py ./
RUN --mount=type=cache,mode=0777,target=/root/.cache/pip python _wandb_bootstrap.py
# ----- stage 2: base -----
FROM python:3.11-buster as base
COPY --from=build /env /env
ENV PATH="/env/bin:$PATH"
ENV SHELL /bin/bash
# some resources (eg sagemaker) must run on root
RUN useradd --create-home --no-log-init --shell /bin/bash --gid 0 --uid 1000 timh || echo ""
USER timh
WORKDIR /home/timh
RUN chown -R 1000 /home/timh
# make artifacts cache dir unrelated to build
RUN mkdir -p /home/timh/.cache && chown -R 1000 /home/timh/.cache
# copy code/etc
COPY --chown=1000 src/ /home/timh
ENV PYTHONUNBUFFERED=1
RUN echo "hello from Dockerfile.artifact at root"
ENTRYPOINT ["python", "train.py"]