-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebian.dockerfile
More file actions
165 lines (133 loc) · 4.34 KB
/
debian.dockerfile
File metadata and controls
165 lines (133 loc) · 4.34 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
ARG version bullseye
FROM debian:${version:-latest}
LABEL maintainer="ca971 <contact@ca971.dev>"
LABEL name="PaaS-docker"
LABEL version="latest"
# Non Interactive MODE
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true
# Set shell command by SHELL [ “/bin/bash”, “-l”, “-c” ] and simply call RUN ....
SHELL [ "/bin/bash", "-l", "-c" ]
# Non privileged user
ARG USER_NAME=ca971
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Set PATH
ENV PATH=~/.pyenv/shims:~/.pyenv/bin:~/.rbenv/shims:~/.rbenv/bin:~/.nvm/bin:/usr/local/rvm/bin:~/.linuxbrew/bin:$PATH:/usr/games
ENV FZF_BASE=$HOME/.fzf
# Add sources.list
COPY bullseye-sources.list /etc/apt/sources.list
RUN \
export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE="1" \
&& apt-get update \
&& apt-get install -y sudo wget
# Add a group for $USER_NAME
RUN groupadd --gid $USER_GID $USER_NAME
# Add a non-root User
RUN useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USER_NAME
# Set Sudoers for $USER_NAME
RUN echo $USER_NAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USER_NAME
# Protect $USER_NAME sudo file
RUN chmod 0440 /etc/sudoers.d/$USER_NAME
# Set permissions for $USER_NAME directory
RUN chown $USER_NAME:$USER_NAME -R "/home/$USER_NAME"
# User "$USER_NAME" as non-root user
#USER $USER_NAME
# Install Oh-my-zsh with zsh-in-docker
COPY zsh-docker.sh /tmp
RUN /tmp/zsh-docker.sh \
-t https://github.com/denysdovhan/spaceship-prompt \
-a 'SPACESHIP_PROMPT_ADD_NEWLINE="false"' \
-a 'SPACESHIP_PROMPT_SEPARATE_LINE="false"' \
-p git \
-p sudo \
-p fzf \
-p vi-mode \
-p https://github.com/zsh-users/zsh-autosuggestions \
-a 'ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#005073,bold,underline"' \
-p https://github.com/paulirish/git-open \
-p https://github.com/zsh-users/zsh-completions \
-p https://github.com/zsh-users/zsh-history-substring-search \
-p https://github.com/zsh-users/zsh-syntax-highlighting \
-p 'history-substring-search' \
-a 'bindkey "\$terminfo[kcuu1]" history-substring-search-up' \
-a 'bindkey "\$terminfo[kcud1]" history-substring-search-down'
WORKDIR /tmp
RUN git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew \
&& mkdir \
~/.linuxbrew/bin \
~/.nvm \
~/.pyenv \
~/.rbenv \
~/.ssh \
&& ln -s ../Homebrew/bin/brew ~/.linuxbrew/bin \
&& eval $(~/.linuxbrew/bin/brew shellenv) \
&& brew --version \
&& brew tap homebrew/core \
&& brew tap buo/cask-upgrade \
&& brew tap jakewmeyer/geo \
&& brew tap neovim/neovim \
&& brew tap universal-ctags/universal-ctags \
&& brew tap homebrew/aliases \
&& brew update && brew install \
pyenv \
pyenv-virtualenv \
pipenv \
rbenv \
rbenv-aliases \
bat \
fzf \
nvm
RUN \
nvm install node \
&& nvm alias default node \
&& nvm use default \
&& nvm install --lts \
&& nvm use --lts \
&& npm install -g yarn
# Install pyenv, pyenv-virtualenv and default python version
ENV PYTHON_VERSION 3.9.6
ENV PYTHONDONTWRITEBYTECODE true
ENV PYENV_VIRTUALENVWRAPPER_PREFER_PYVENV true
COPY requirements.txt /tmp
RUN \
pyenv install $PYTHON_VERSION \
&& pyenv virtualenv $PYTHON_VERSION python_3 \
&& pyenv global python_3
RUN \
pip install --upgrade pip \
pip install -r /tmp/requirements.txt
# Set python3 and pip3 as default python
RUN update-alternatives --install /usr/bin/python python $HOME/.pyenv/versions/python_3/bin/python 3
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 2
RUN update-alternatives --install /usr/bin/python python /usr/bin/python2 1
# Install Rbenv
ENV RUBY_VERSION 3.0.2
RUN \
rbenv-alias --auto \
&& rbenv install $RUBY_VERSION \
&& rbenv global $RUBY_VERSION \
&& gem install bundler
COPY id_rsa /tmp
# SSH
RUN \
eval $(ssh-agent -s) \
&& mv id_rsa ~/.ssh \
&& echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config \
&& chmod go-w /root \
&& chmod 700 /root/.ssh \
&& chmod 600 /root/.ssh/id_rsa \
&& ssh-add ~/.ssh/id_rsa
#&& git clone <your-git-repo-ssh-url>
# Clean and erase apt cache
RUN apt-get clean -y \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/ /tmp/* \
&& brew cleanup
# Tells systemd that it's running inside a Docker container environment
ENV container docker
ADD . $HOME/code
WORKDIR $HOME/code
CMD ["/bin/zsh","-l"]
# vim: set ft=dockerfile: