forked from coder/envbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
82 lines (73 loc) · 2.55 KB
/
Dockerfile
File metadata and controls
82 lines (73 loc) · 2.55 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
# Ubuntu 22.04 LTS (Jammy Jellyfish)
FROM ubuntu:jammy
ARG TARGETARCH
# This should be updated in the Makefile whenever the version is changed.
# We don't hardcode it here because we have to be able to build both
# amd and arm
ARG SYSBOX_SHA
ARG SYSBOX_VERSION="0.7.0"
ARG SYSBOX_DEB="sysbox-ce_$SYSBOX_VERSION-0.linux_$TARGETARCH.deb"
# Copy configuration files to appropriate locations
COPY files /
LABEL \
org.opencontainers.image.title="Envbox" \
org.opencontainers.image.url="https://github.com/coder/envbox" \
org.opencontainers.image.source="https://github.com/coder/envbox" \
org.opencontainers.image.description="Run Docker in Docker in Kubernetes"
# Basic utilities
ARG DEBIAN_FRONTEND=noninteractive
# Pin docker to avoid any breaking API changes between the Go client and
# the server. Use latest LTS/stable from https://download.docker.com/linux/ubuntu/dists/jammy/pool/stable/
ARG DOCKER_VERSION="5:29.2.1-1~ubuntu.22.04~jammy"
# Ignore other repositories, as some require HTTPS
RUN apt-get update --quiet --option Dir::Etc::SourceParts="" && \
apt-get upgrade -y && \
apt-get install --no-install-recommends --yes --quiet --option Dir::Etc::SourceParts="" \
apt-transport-https \
apt-utils \
binutils \
ca-certificates \
curl \
dialog \
fuse3 \
iproute2 \
jq \
kmod \
lsb-release \
make \
mokutil \
rsync \
systemctl \
wget \
vim && \
# Install packages from third-party repositories
apt-get update --quiet && \
apt-get install --no-install-recommends --yes --quiet \
containerd.io \
docker-ce=$DOCKER_VERSION \
docker-ce-cli=$DOCKER_VERSION && \
# Delete package cache to avoid consuming space in layer
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN wget https://downloads.nestybox.com/sysbox/releases/v$SYSBOX_VERSION/$SYSBOX_DEB && \
echo "$SYSBOX_SHA $SYSBOX_DEB" | sha256sum --check --status && \
apt install -y "./$SYSBOX_DEB" && \
rm "./$SYSBOX_DEB" && \
userdel -r sysbox
# This is jank but sysbox adds their own /etc/docker/daemon.json that overwrites ours when it gets installed,
# so we copy over their changes to get the configurations we actually want.
COPY files /
# Add coder user
RUN useradd coder \
--create-home \
--shell=/bin/bash \
--groups=docker \
--uid=1000 \
--user-group && \
usermod coder \
--add-subuids 100000-165535 \
--add-subgids 100000-165535
# Do this last so hotswapping is fast!
ARG ENVBOX_BIN=envbox
COPY $ENVBOX_BIN /
CMD ["/envbox"]