-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathml.Dockerfile
More file actions
75 lines (62 loc) · 2.11 KB
/
Copy pathml.Dockerfile
File metadata and controls
75 lines (62 loc) · 2.11 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Image for ML and python work
# tensorflow packages and requirements are based on
# docker pull tensorflow/tensorflow:latest
# at https://hub.docker.com/r/tensorflow/tensorflow
# See ml.sh for usage
# 220308: build with u20.04 3.37GB image
# 240106: tensorflow docker has become a lot more complex
# Need Ubuntu for GUI mapping
# FROM ubuntu:18.04 as base
# 220308 use 20.04 for updated python
# FROM ubuntu:20.04 as base
# 240106 use tensorflow (U22.04.3 LTS) as base
FROM tensorflow/tensorflow as base
ENV LANG C.UTF-8
MAINTAINER dturvene@gmail.com
# hack so apt-get does not prompt user
ENV DEBIAN_FRONTEND=noninteractive
# should be softlinked to /usr/bin/python3.11 /usr/local/bin/pip3.11
ARG PYTHON=python
ARG PIP=pip
ARG USER=user1
ARG GROUP=user1
# These must be identical to the host user for shared volumes
ARG USERID=1000
ARG GROUPID=1000
# update base packages (based on cpu.Dockerfile)
# install python, pip, python-tk (for X11 display) and tools
# add miminal gstreamer debian packages
# see https://gstreamer.freedesktop.org/documentation/installing/on-linux.html
# add gstreamer python3, introspection, plugin dev
RUN apt-get update --fix-missing && \
apt-get install -y \
python3-tk \
vim \
sudo
# don't do this in order to add packages at run-time
# otherwise need to do `apt-get update` to pull lists
# rm -rf /var/lib/apt/lists/*
# update PIP
RUN ${PIP} --no-cache-dir install --upgrade \
pip \
setuptools
# install support python packages
RUN ${PIP} install \
numpy \
pandas \
matplotlib \
seaborn \
scipy
# install tensorflow packages
RUN ${PIP} install tensorflow_datasets
RUN ${PIP} install tensorflow_hub
# update system-wide bashrc before creating user
COPY bashrc.docker /etc/skel/.bashrc
# create user and group to have same ID as the host user
# add to sudoers for in-container work
# add to video group to use /dev/video0 webcam
RUN adduser --disabled-password --gecos '' ${USER} && \
adduser ${USER} sudo && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
usermod -a -G video ${USER}
# in container, set $USER on commandline or `su $USER`