-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (26 loc) · 876 Bytes
/
Dockerfile
File metadata and controls
36 lines (26 loc) · 876 Bytes
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
FROM tensorflow/tensorflow:2.15.0-gpu
# maintainer
LABEL maintainer="fname.lname@domain.com"
# set username & uid inside docker
ARG UNAME=user1
ARG UID=1000
ENV WORKDIR="/home/$UNAME/tensorflow_training"
# add user UNAME as a member of the sudoers group
RUN useradd -rm --home-dir "/home/$UNAME" --shell /bin/bash -g root -G sudo -u "$UID" "$UNAME"
# set workdir
WORKDIR ${WORKDIR}
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# setup virtual env for python
ENV VIRTUAL_ENV="/home/$UNAME/venv"
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# install python dependencies
RUN pip install pip==24.0
COPY ./requirements.txt .
RUN pip install --no-cache-dir --default-timeout=100 -r requirements.txt
# freq changing files are added below
COPY . "$WORKDIR"
# change file ownership to docker user
RUN chown -R "$UNAME" "$WORKDIR"
USER "$UNAME"