aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
blob: c22fc4850e3587ac4d0e239898b5d5eb1aecb8ea (plain)
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
FROM ubuntu:18.04
MAINTAINER Cody Hiar <codyfh@gmail.com>

########################################
# System Stuff
########################################

# Better terminal support
ENV TERM screen-256color
ENV DEBIAN_FRONTEND noninteractive

# Update and install
RUN apt-get update && apt-get install -y \
      htop \
      bash \
      curl \
      wget \
      git \
      software-properties-common \
      python-dev \
      python-pip \
      python3-dev \
      python3-pip \
      ctags \
      shellcheck \
      netcat \
      ack-grep \
      sqlite3 \
      unzip \
      # For python crypto libraries
      libssl-dev \
      libffi-dev \
      locales \
      # For Youcompleteme
      cmake

# Generally a good idea to have these, extensions sometimes need them
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

# Install Neovim
RUN add-apt-repository ppa:neovim-ppa/stable
RUN apt-get update && apt-get install -y \
      neovim

# Install Ledger
RUN add-apt-repository ppa:mbudde/ledger
RUN apt-get update && apt-get install -y \
      ledger

# Install Terraform for linting
RUN wget https://releases.hashicorp.com/terraform/0.11.8/terraform_0.11.8_linux_amd64.zip && \
    unzip terraform_0.11.8_linux_amd64.zip && \
    mv terraform /usr/bin

# Ubuntu ranger old and doesn't support 'wrap_scroll'.
RUN git clone https://github.com/thornycrackers/ranger.git /tmp/ranger && \
    cd /tmp/ranger && \
    make install

########################################
# Python
########################################

# Install python linting and neovim plugin
ADD py2_requirements.txt /opt/py2_requirements.txt
RUN cd /opt && pip2 install -r py2_requirements.txt

ADD py3_requirements.txt /opt/py3_requirements.txt
RUN cd /opt && pip3 install -r py3_requirements.txt


########################################
# Personalizations
########################################
# Setup non root user
RUN groupadd -g 1000 thorny
RUN useradd -m -d /home/thorny -s /bin/bash -g thorny -u 1000 thorny
USER thorny
# Add some aliases
COPY --chown=thorny bashrc /home/thorny/.bashrc
# Add my git config
COPY --chown=thorny gitconfig /home/thorny/.gitconfig
# Neovim needs this so that <ctrl-h> can work
RUN infocmp $TERM | sed 's/kbs=^[hH]/kbs=\\177/' > /home/thorny/$TERM.ti
RUN tic /home/thorny/$TERM.ti
# Command for the image
CMD ["/bin/bash"]
# Add nvim config. Put this last since it changes often
COPY --chown=thorny nvim /home/thorny/.config/nvim
# Install neovim plugins
RUN nvim -i NONE -c PlugInstall -c quitall > /dev/null 2>&1
RUN cd /home/thorny/.config/nvim/plugged/YouCompleteMe && python3 install.py
# Add flake8 config, don't trigger a long build process
COPY --chown=thorny flake8 /home/thorny/.flake8
# Add local vim-options, can override the one inside
COPY --chown=thorny vim-options /home/thorny/.config/nvim/plugged/vim-options
# Add isort config, also changes often
COPY --chown=thorny isort.cfg /home/thorny/.isort.cfg
# Add ranger config
COPY --chown=thorny rc.conf /home/thorny/.config/ranger/rc.conf
# Set the workdir
WORKDIR /src