-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
84 lines (65 loc) · 2.9 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
81
82
83
84
#-------------------------------------------------------------------------------------------------------------
# Based on a template by Microsoft Corporation.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
# adapted by Thomas Gölles
#-------------------------------------------------------------------------------------------------------------
FROM continuumio/miniconda3:latest
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
# this user's GID/UID must match your local user UID/GID to avoid permission issues
# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See
# https://aka.ms/vscode-remote/containers/non-root-user for details.
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Configure apt and install packages
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
&& apt-get -y install locales build-essential git zsh\
#
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
&& chmod 0440 /etc/sudoers.d/$USERNAME \
# to download data
&& apt-get -y install netcat curl wget unzip\
#
# handy tools
&& apt-get -y install imagemagick imagemagick-doc hunspell man\
#
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# install conda environment from file
ARG PYTHON_VERSION
ENV PYTHON_VERSION=${PYTHON_VERSION}
# allow to conver pdf with imagmagick
RUN sed -i '/disable ghostscript format types/,+6d' /etc/ImageMagick-6/policy.xml
# prepend conda environment to path
ENV PATH $CONDA_DIR/envs/${conda_env}/bin:$PATH
# setup Zsh
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.5/zsh-in-docker.sh)" -- \
-t https://github.com/romkatv/powerlevel10k \
-p https://github.com/zsh-users/zsh-autosuggestions \
-p https://github.com/zsh-users/zsh-completions
ENV SHELL /bin/zsh
# zsh config
COPY .zshrc /root/.zshrc
COPY .p10k.zsh /tmp/root-code-zsh/.p10k.zsh
# addding conda environment
COPY environment$PYTHON_VERSION.yml /tmp/conda-tmp/environment$PYTHON_VERSION.yml
# HACK due to conda bug
RUN /opt/conda/bin/conda update conda
RUN /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment$PYTHON_VERSION.yml
# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=""
ENTRYPOINT [ "/bin/zsh", "-l"]