-
Notifications
You must be signed in to change notification settings - Fork 323
/
Copy pathDockerfile
80 lines (68 loc) · 2.49 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
75
76
77
78
79
80
FROM buildpack-deps:jammy@sha256:1a63cc50ec6f4f45440121af59c47f78ca390607714ac0886c1588d118526b40
# Dazzle does not rebuild a layer until one of its lines are changed. Increase this counter to rebuild this layer.
ENV TRIGGER_REBUILD=2
COPY install-packages upgrade-packages /usr/bin/
### base ###
RUN yes | unminimize \
&& install-packages \
zip \
unzip \
bash-completion \
build-essential \
ninja-build \
clang \
htop \
iputils-ping \
jq \
less \
locales \
man-db \
nano \
ripgrep \
software-properties-common \
sudo \
stow \
time \
emacs-nox \
vim \
multitail \
lsof \
ssl-cert \
fish \
zsh \
rlwrap \
&& locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8
### Update and upgrade the base image ###
RUN upgrade-packages
### Git ###
RUN add-apt-repository -y ppa:git-core/ppa
# https://github.com/git-lfs/git-lfs/blob/main/INSTALLING.md
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
RUN install-packages git git-lfs
### Gitpod user ###
# '-l': see https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
RUN useradd -l -u 33333 -G sudo -md /home/gitpod -s /bin/bash -p gitpod gitpod \
# Remove `use_pty` option and enable passwordless sudo for users in the 'sudo' group
&& sed -i.bkp -e '/Defaults\tuse_pty/d' -e 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' /etc/sudoers \
# To emulate the workspace-session behavior within dazzle build env
&& mkdir /workspace && chown -hR gitpod:gitpod /workspace
ENV HOME=/home/gitpod
WORKDIR $HOME
# custom Bash prompt
RUN { echo && echo "PS1='\[\033[01;32m\]\u\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\]\$(__git_ps1 \" (%s)\") $ '" ; } >> .bashrc
COPY default.gitconfig /etc/gitconfig
COPY --chown=gitpod:gitpod default.gitconfig /home/gitpod/.gitconfig
# configure git-lfs
RUN git lfs install --system --skip-repo
### Gitpod user (2) ###
USER gitpod
# use sudo so that user does not get sudo usage info on (the first) login
RUN sudo echo "Running 'sudo' for Gitpod: success" && \
# create .bashrc.d folder and source it in the bashrc
mkdir -p /home/gitpod/.bashrc.d && \
(echo; echo "for i in \$(ls -A \$HOME/.bashrc.d/); do source \$HOME/.bashrc.d/\$i; done"; echo) >> /home/gitpod/.bashrc && \
# create a completions dir for gitpod user
mkdir -p /home/gitpod/.local/share/bash-completion/completions
# Custom PATH additions
ENV PATH=$HOME/.local/bin:/usr/games:$PATH