-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
130 lines (110 loc) · 3.11 KB
/
Dockerfile
File metadata and controls
130 lines (110 loc) · 3.11 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
ARG VERSION=latest
FROM ubuntu:$VERSION
# Fix "Couldn't register with accessibility bus" error message
ENV NO_AT_BRIDGE=1
ENV DEBIAN_FRONTEND noninteractive
# basic stuff
RUN echo 'APT::Get::Assume-Yes "true";' >> /etc/apt/apt.conf \
&& apt-get update && apt-get install \
apt-utils \
bash \
build-essential \
dbus-x11 \
fontconfig \
git \
gzip \
language-pack-en-base \
libgl1-mesa-glx \
make \
sudo \
tar \
unzip \
curl \
openssl \
openssh-server \
ripgrep \
fd-find \
tmux \
sed \
clangd \
# su-exec
&& git clone https://github.com/ncopa/su-exec.git /tmp/su-exec \
&& cd /tmp/su-exec \
&& make \
&& chmod 770 su-exec \
&& mv ./su-exec /usr/local/sbin/ \
# Cleanup
&& apt-get purge build-essential \
&& apt-get autoremove \
&& rm -rf /tmp/* /var/lib/apt/lists/* /root/.cache/*
#COPY asEnvUser /usr/local/sbin/
# Only for sudoers
#RUN chown root /usr/local/sbin/asEnvUser \
# && chmod 770 /usr/local/sbin/asEnvUser
# ^^^^^^^ Those layers are shared ^^^^^^^
# Emacs
RUN apt-get update && apt-get install software-properties-common \
&& apt-get install emacs \
# Cleanup
&& apt-get purge software-properties-common \
&& rm -rf /tmp/* /var/lib/apt/lists/* /root/.cache/*
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
RUN apt-get update && \
apt-get install -y --no-install-recommends openssh-server tmux \
curl git \
python3 python3-pip python3-virtualenv python3-dev build-essential
RUN apt-get update && \
apt-get install -y python3 \
python3-pip \
python3-virtualenv \
python3-dev
ENV user emacs
RUN useradd -G sudo -u 1000 --create-home ${user}
RUN adduser ${user} sudo && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER ${user}
ENV HOME /home/emacs
ENV UNAME="emacs" \
GNAME="emacs" \
UHOME="/home/emacs" \
UID="1000" \
GID="1000" \
WORKSPACE="/mnt/workspace" \
SHELL="/bin/bash"
RUN echo "PATH=$HOME/.config/emacs/bin:$PATH" >> $HOME/.bashrc && . $HOME/.bashrc
# Emacs Doom
RUN mkdir /home/emacs/.config && \
git clone --depth 1 https://github.com/doomemacs/doomemacs /home/emacs/.config/emacs && \
~/.config/emacs/bin/doom install --no-env && \
sed -i '/(evil +everywhere)/s/^/;;/' /home/emacs/.config/doom/init.el && \
sed -i '/;;lsp/s/^ *;;/ /' /home/emacs/.config/doom/init.el && \
sed -i '/;;tree-sitter/s/^ *;;/ /' /home/emacs/.config/doom/init.el && \
sed -i '/;;(cc +lsp)/s/^ *;;/ /' /home/emacs/.config/doom/init.el && \
/home/emacs/.config/emacs/bin/doom sync
CMD ["bash", "-c", "emacs; /bin/bash"]
#
# Create image with:
#
# docker build --tag run-emacs-docker .
#
# Run with this:
#
##!/bin/bash
#
#xhost +si:localuser:mattmc
#
#docker run -it --rm \
# --name emacs \
# -e HOME="/home/emacs" \
# -e DISPLAY="$DISPLAY" \
# -e UID="1000" \
# -e GID="1000" \
# -w `pwd` \
# -v /tmp/.X11-unix:/tmp/.X11-unix \
# -v `pwd`:`pwd` \
# --user 1000 \
# --net=host \
# run-emacs-docker $1 $2
#
#xhost -local: