This repository has been archived by the owner on Feb 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
52 lines (42 loc) · 2.44 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
FROM ubuntu:20.04
LABEL maintainer="Petr Ruzicka <[email protected]>"
ENV DEBIAN_FRONTEND noninteractive
ENV HOME /home/docker
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN addgroup --gid 1001 docker && \
adduser --uid 1001 --ingroup docker --home /home/docker --shell /bin/sh --disabled-password --gecos "" docker
# https://github.com/boxboat/fixuid
RUN set -x \
&& apt-get update \
&& echo virtualbox-ext-pack virtualbox-ext-pack/license select true | debconf-set-selections \
&& apt-get install -y --no-install-recommends ca-certificates curl jq libc-dev libvirt-clients libvirt-dev openssh-client pkg-config python3-cffi-backend python3-distutils python3-jinja2 python3-paramiko python3-pip python3-pyasn1 python3-setuptools python3-wheel python3-winrm python3-yaml qemu-kvm qemu-utils rsync sshpass unzip virtualbox-ext-pack virtualbox \
\
&& pip3 install --no-cache-dir ansible \
\
&& VAGRANT_LATEST_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/vagrant | jq -r -M '.current_version') \
&& curl -s "https://releases.hashicorp.com/vagrant/${VAGRANT_LATEST_VERSION}/vagrant_${VAGRANT_LATEST_VERSION}_x86_64.deb" --output /tmp/vagrant_x86_64.deb \
&& apt-get install --no-install-recommends -y /tmp/vagrant_x86_64.deb \
&& rm /tmp/vagrant_x86_64.deb \
\
&& vagrant plugin install vagrant-libvirt \
&& chown -R docker:docker /home/docker \
\
&& FIXUID_VERSION=$(curl --silent "https://api.github.com/repos/boxboat/fixuid/releases/latest" | sed -n 's/.*"tag_name": "v\([^"]*\)",/\1/p') \
&& curl -SsL "https://github.com/boxboat/fixuid/releases/download/v${FIXUID_VERSION}/fixuid-${FIXUID_VERSION}-linux-amd64.tar.gz" | tar -C /usr/local/bin -xzf - \
&& chown root:root /usr/local/bin/fixuid \
&& chmod 4755 /usr/local/bin/fixuid \
&& mkdir -p /etc/fixuid \
&& printf "user: docker\ngroup: docker\npaths:\n - /home/docker" > /etc/fixuid/config.yml \
\
&& apt-get purge -y curl jq libc-dev libvirt-dev pkg-config python3-distutils python3-pip python3-setuptools python3-wheel unzip \
&& rm -Rf /var/lib/apt/lists/* \
&& rm -Rf /usr/share/doc && rm -Rf /usr/share/man \
&& apt-get clean
COPY startup_script.sh /
USER docker:docker
# The virtualbox driver device must be mounted from host
VOLUME /dev/vboxdrv
# The libvirt socket must be mounted from host
VOLUME /var/run/libvirt/libvirt-sock
WORKDIR /home/docker/vagrant
ENTRYPOINT ["/startup_script.sh"]