-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
118 lines (104 loc) · 4.47 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
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
FROM {{.Base}}
# Restore man pages, etc. stripped from Ubuntu to minimize default image size.
RUN yes | unminimize
# Check package availability. To rerun, pass --no-cache to docker image build.
RUN apt-get update -qq
# Set locale.
RUN DEBIAN_FRONTEND=noninteractive apt-get install -qqy locales \
&& locale-gen {{.Locale}} \
&& dpkg-reconfigure --frontend noninteractive locales \
&& echo LC_ALL={{.Locale}} >>/etc/default/locale
ENV LANG={{.Locale}}
# Set time zone.
RUN DEBIAN_FRONTEND=noninteractive apt-get install -qqy tzdata \
&& ln -snf /usr/share/zoneinfo/{{.TimeZone}} /etc/localtime \
&& echo {{.TimeZone}} > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata
ENV TZ={{.TimeZone}}
# Install command-line tools.
#
# programming languages:
# c # C and C++ toolchain and standard library
# (build-essential)
#
# clang-format # C/C++ beautifier
# cmake # CMake build file generator
# golang # The Go programming language
#
# python3 # Python 3 with pip, venv, and headers
# (mypy python3-pip python3-venv)
#
# network:
# curl # HTTP utility
# libssl-dev # OpenSSL libraries; required by cargo-audit
# net-tools # ifconfig et al
# ping # iputils-ping
# rsync # tool for synchronizing directory contents
# whois # shows domain names registration details
#
# netcat # TCP/IP Swiss army knife
# (netcat-traditional)
#
# basic commands:
# file # guesses file types
# git # version control system
# jq # parses, queries, transforms, and formats JSON
# inotify-tools # use inotifywait to run commands when a file changes
# man # manual page viewer
# markdown # converts Markdown files to HTML
# cal (ncal) # calendar
# sudo # runs commands as superuser
# zip # creates or expands .zip compressed archives
#
# enhanced commands:
# bat # alternative to cat
# fd (fd-find) # alternative to find
# neovim # fork of vim
# ripgrep # alternative to grep
# sl # steam locomotive when you mistype ls
# tmux # terminal multiplexer
# zsh # alternative to sh
#
# data:
# lsb-release # /etc/lsb-release
# wamerican # /usr/share/dict/words
#
RUN DEBIAN_FRONTEND=noninteractive apt-get install -qqy \
build-essential clang-format cmake golang python3-pip python3-venv \
curl file iputils-ping libssl-dev net-tools netcat-traditional rsync whois \
git inotify-tools jq man markdown ncal sudo zip \
bat fd-find neovim ripgrep sl tmux zsh \
lsb-release wamerican \
&& python3 -m pip install mypy
# Ensure prerequisites for pyenv. See:
# https://stackoverflow.com/a/74314165/3116635
RUN DEBIAN_FRONTEND=noninteractive apt-get install -qqy \
build-essential zlib1g-dev libffi-dev libssl-dev libbz2-dev \
libreadline-dev libsqlite3-dev liblzma-dev
# Install a web browser so I can run (headless) JavaScript test drivers.
RUN DEBIAN_FRONTEND=noninteractive apt-get install -qqy firefox
# Install the AWS CLI, which is a prerequisite for Terraform.
RUN curl -OSs https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip \
&& unzip awscli-exe-linux-x86_64.zip \
&& ./aws/install \
&& rm -fr aws awscli-exe-linux-x86_64.zip
# Install the Terraform CLI.
# RUN curl -Ss https://apt.releases.hashicorp.com/gpg \
# | gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg \
# && echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" > /etc/apt/sources.list.d/hashicorp.list \
# && DEBIAN_FRONTEND=noninteractive apt-get update -qq \
# && DEBIAN_FRONTEND=noninteractive apt-get install terraform
# Install Java.
RUN DEBIAN_FRONTEND=noninteractive apt-get install -qqy default-jdk-headless
# Create myself, and give myself super powers.
#
# Enabling sudo coredumps works around a container bug that makes sudo unhappy:
# https://github.com/sudo-project/sudo/issues/42
RUN useradd -mk /dev/null -s /usr/bin/zsh {{.User}} \
&& echo '{{.User}} ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
&& echo "Set disable_coredump false" >> /etc/sudo.conf
# Make myself the default user.
USER {{.User}}
# Start containers in my home directory.
WORKDIR /home/{{.User}}
CMD {{ja .Command}}