-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
74 lines (63 loc) · 2.32 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
FROM python:3-slim
ARG USERNAME=pythonista
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG LOCALE=en_US.UTF-8
# Configure apt and install packages
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get upgrade \
&& apt-get -y install --no-install-recommends apt-utils 2>&1 \
&& apt-get -y install --no-install-recommends \
dialog \
git \
openssh-client \
less \
curl \
wget \
unzip \
lsb-release \
ca-certificates \
apt-transport-https \
locales \
sudo \
nano \
vim \
fontconfig \
&& echo "$LOCALE UTF-8" >> /etc/locale.gen \
&& locale-gen \
#
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
# install python packages for linting and formatting
RUN python -m pip install --no-cache-dir -qqq black pylint flake8
# Setup user
RUN adduser --shell /bin/bash --uid $USER_UID --disabled-password --gecos "" $USERNAME \
&& mkdir -p /etc/sudoers.d \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
RUN mkdir -p /home/$USERNAME/.vscode-server/extensions /home/$USERNAME/.vscode-server-insiders/extensions \
&& chown -R $USERNAME /home/$USERNAME/.vscode-server /home/$USERNAME/.vscode-server-insiders
# Powerline font - JetBrains Mono
RUN wget -qO temp.zip https://github.com/JetBrains/JetBrainsMono/releases/download/v1.0.6/JetBrainsMono-1.0.6.zip \
&& unzip temp.zip -d /usr/share/fonts \
&& rm temp.zip \
&& fc-cache -fv \
&& echo "export PATH=\$PATH:\$HOME/.local/bin" | tee -a /root/.bashrc >> /home/$USERNAME/.bashrc
# Setup starship prompt
RUN curl -fsSL https://starship.rs/install.sh | bash -s -- -y \
&& echo "\neval \"\$(starship init bash)\"\n" | tee -a /root/.bashrc >> /home/$USERNAME/.bashrc \
&& chown $USER_UID:$USER_GID /home/$USERNAME/.bashrc \
&& mkdir -p /root/.config /home/$USERNAME/.config \
&& wget -qO- https://raw.githubusercontent.com/LobsterBandit/dotfiles/master/starship.toml \
| tee -a /root/.config/starship.toml >> /home/$USERNAME/.config/starship.toml \
&& chown -R $USER_UID:$USER_GID /home/$USERNAME/.config
ENV LANG=$LOCALE \
DEBIAN_FRONTEND=dialog \
USER=$USERNAME \
PYTHONDONTWRITEBYTECODE=1
USER $USERNAME
WORKDIR /home/$USERNAME
CMD [ "bash" ]