-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.template
83 lines (64 loc) · 3.31 KB
/
Dockerfile.template
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
FROM debian:stretch
LABEL maintainer="Robert Ames ([email protected])"
# build requires user
ARG localuser
RUN test -n "$localuser"
# build requires local password(s)
ARG vncpassword
RUN test -n "$vncpassword"
# sourcebashrc - should first execution of bashrc be included in build
ARG dotfilesrepourl
RUN test -n "$dotfilesrepourl"
# sourcebashrc - should first execution of bashrc be included in build
ARG sourcebashrc
RUN test -n "$sourcebashrc"
# docker run -v /host/directory:/container/directory -other -options image_name command_to_run
# COPY ...src... ..dest...
# https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1332440/comments/4
# (apt-get is slow when ulimit is unlimited or high)
RUN ulimit -n 2000
RUN apt-get update
RUN apt-get install -y sudo
# base linux functionality (mostly never changes!)
RUN apt-get install -y dialog apt-utils
RUN apt-get install -y man openssh-server netcat-openbsd curl
RUN apt-get install -y ruby perl python gcc make
# trying fancy VNC stuff
RUN apt-get install -y x11vnc xvfb firefox-esr
# basic development stuff (also mostly never changes!)
RUN apt-get install -y vim git pass jq
# sudoers, users, and permissions
RUN echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN useradd $localuser -m -s /bin/bash
RUN adduser $localuser sudo
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # switch to unpriveleged user (with full sudo) # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# switch to unpriveleged user (but also has passwordless sudo)
USER $localuser
#CMD ["x11vnc", "-forever", "-usepw", "-create"]
COPY ./motd /home/$localuser/motd
# fancy x11vnc stuff
RUN mkdir -p /home/$localuser/.vnc
RUN x11vnc -storepasswd $vncpassword /home/$localuser/.vnc/passwd
EXPOSE 5900
CMD [ "/bin/bash", "-c", "cd ~" ]
############# NOT BAKING ####################
#IFNOT_BAKE RUN echo '' > ~/.bashrc
#IFDEF_BAKE RUN echo 'export DOTFILES=~/Git/__dotfiles__/' >> ~/.bashrc
#IFNOT_BAKE RUN echo 'test -f ~/Git/__dotfiles__/script/bootstrap && printf "Robert Ames\\[email protected]\\n" | ~/Git/__dotfiles__/script/bootstrap' >> ~/.bashrc
#IFNOT_BAKE RUN echo 'test -f ~/Git/__dotfiles__/bash/profile && source ~/Git/__dotfiles__/bash/profile' >> ~/.bashrc
#IFNOT_BAKE RUN echo 'test -f ~/Git/__dotfiles__/bin/ensure-debian-maintained && ~/Git/__dotfiles__/bin/ensure-debian-maintained' >> ~/.bashrc
#IFNOT_BAKE RUN echo 'test -f ~/Git/__dotfiles__/bash/profile || cat ~/motd' >> ~/.bashrc
############# YES BAKING ####################
#IFDEF_BAKE RUN git clone $dotfilesrepourl ~/.dotfiles/
#IFDEF_BAKE RUN echo '' > ~/.bashrc
#IFDEF_BAKE RUN echo 'export DOTFILES=~/.dotfiles/' >> ~/.bashrc
#IFDEF_BAKE RUN echo 'test -f ~/.dotfiles/script/bootstrap && printf "Robert Ames\\[email protected]\\n" | ~/.dotfiles/script/bootstrap' >> ~/.bashrc
#IFDEF_BAKE RUN echo 'test -f ~/.dotfiles/bash/profile && source ~/.dotfiles/bash/profile' >> ~/.bashrc
#IFDEF_BAKE RUN echo 'test -f ~/.dotfiles/bin/ensure-debian-maintained && ~/.dotfiles/bin/ensure-debian-maintained' >> ~/.bashrc
#IFDEF_BAKE RUN echo 'test -f ~/.dotfiles/bash/profile || cat ~/motd' >> ~/.bashrc
#IFDEF_BAKE RUN bash ~/.bashrc
#RUN if [ "${sourcebashrc}" = "1" ]; then bash -c 'source ~/.bashrc'; fi