-
Notifications
You must be signed in to change notification settings - Fork 0
/
latex.Dockerfile
131 lines (110 loc) · 3.28 KB
/
latex.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
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
##############################################
# LaTeX container for development
##############################################
###########################################
# Base image
###########################################
FROM ubuntu:22.04 AS base
ENV DEBIAN_FRONTEND=noninteractive
# Install language
RUN apt-get update && apt-get install -y --no-install-recommends \
locales \
&& locale-gen en_US.UTF-8 \
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 \
&& rm -rf /var/lib/apt/lists/*
ENV LANG en_US.UTF-8
# Install timezone
RUN ln -fs /usr/share/zoneinfo/EST /etc/localtime \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install -y --no-install-recommends tzdata \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*
# Set time zone
ENV TZ="Canada/Eastern"
RUN date
# Install texlive
RUN apt-get update && apt-get install -y --no-install-recommends \
texlive \
latexmk \
git \
make \
ssh \
&& rm -rf /var/lib/apt/lists/*
# Set user name
ARG USERNAME=latex
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Create a non-root user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
# [Optional] Add sudo support for the non-root user
&& apt-get update \
&& apt-get install -y --no-install-recommends sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
&& chmod 0440 /etc/sudoers.d/$USERNAME \
# Cleanup
&& rm -rf /var/lib/apt/lists/* \
&& echo "source /usr/share/bash-completion/completions/git" >> /home/$USERNAME/.bashrc
# Create a development directory
RUN mkdir -p ~/Dev
ENV DEBIAN_FRONTEND=
###########################################
# Full latexmk image
###########################################
FROM base AS full
ARG USERNAME
ARG USER_UID
ARG USER_GID
ENV DEBIAN_FRONTEND=noninteractive
RUN sudo apt-get update \
&& sudo apt-get install -y --no-install-recommends \
zathura \
okular \
mupdf \
xdotool \
wget \
texlive-full \
&& sudo rm -rf /var/lib/apt/lists/*
ENV DEBIAN_FRONTEND=
###########################################
# Develop image
###########################################
FROM full AS dev
ARG USERNAME
ARG USER_UID
ARG USER_GID
ENV DEBIAN_FRONTEND=noninteractive
RUN sudo apt-get update \
&& sudo apt-get install -y --no-install-recommends \
zsh \
build-essential \
gdb \
neovim \
python3-pip \
&& sudo rm -rf /var/lib/apt/lists/*
# Install fzf
RUN git clone https://github.com/junegunn/fzf.git ~/Dev/external/fzf \
&& cd ~/Dev/external/fzf \
&& ./install --all
# Clone custom workstation setup and setup packages
RUN git clone https://github.com/aalbaali/workstation_setup.git ~/Dev/workstation_setup \
&& cd ~/Dev/workstation_setup \
&& sudo ./scripts/install_packages.sh \
&& rm ~/.bashrc \
&& rm ~/.zshrc \
&& if [ -f ~/.gitconfig ]; then rm ~/.gitconfig; fi \
&& ./scripts/post_install_setup.sh \
--zsh \
--zsh-setup \
--bash \
--functions \
--git \
--nvim \
--nvim-setup \
--clang_format \
--gdb \
--tmux \
--tmux-setup
ENV DEBIAN_FRONTEND=
CMD ["zsh"]