-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
55 lines (44 loc) · 1.56 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
49
50
51
52
53
54
55
# Set user and other arguments
ARG USER=docker
ARG UID=1000
ARG GID=1000
ARG PW=docker
ARG DEBIAN_FRONTEND="noninteractive"
FROM ubuntu:20.04 as base-build-python
ARG DEBIAN_FRONTEND
ENV TZ="America/New_York"
# Initial setup of development environment
# Installs wget, gnupg and software-properties-common for add-apt-repository commands
# Initial environment allows development of python scripts
RUN apt-get -y update \
&& apt-get -y --no-install-recommends install wget gnupg git sudo \
ca-certificates software-properties-common \
python3.8 python3.8-distutils \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Add minimal X packages and install Visual Studio Code
FROM base-build-python AS base-build-gui
ARG DEBIAN_FRONTEND
# Add Visual Studio Repository
RUN wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | apt-key add -
RUN add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
RUN apt-get -y update \
&& apt-get -y --no-install-recommends install \
libx11-xcb1 x11-apps libasound2 libxcb-dri3-0 \
libxtst6 xterm \
&& apt-get -y install --no-install-recommends code \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Build the final version
FROM base-build-gui AS base-build-user
ARG USER
ARG UID
ARG GID
ARG PW
# Setup the user
RUN useradd -m ${USER} --uid=${UID} && echo "${USER}:${PW}" | chpasswd \
&& usermod -aG sudo ${USER}
USER ${UID}:${GID}
WORKDIR /home/${USER}
COPY --chown=${USER}:${USER} home/* /home/${USER}
VOLUME /home/${USER}