Dockerfile 1.51 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
## Stage 1: build a customised version of openssh (that expects to be installed inside /.toolbox/) ##
FROM allgo/base-debian AS builder
RUN set -x ;\
	sed -i '/^deb /p ; s/^deb /deb-src /' /etc/apt/sources.list	&&\
	apt-getq update							&&\
	apt-getq build-dep openssh					&&\
	mkdir /src && cd /src && apt-get source openssh

COPY ssh_override_paths.diff /src
RUN set -x ;\
	cd /src/openssh-*			&&\
	patch -p1 < ../ssh_override_paths.diff	&&\
	dpkg-buildpackage -b			&&\
	cd ..					&&\
	for pkg in openssh-client openssh-server ; do mv "$pkg"_*.deb "$pkg".deb ; done


## Stage 2: build the toolbox image ##
19 20
FROM allgo/base-debian

BAIRE Anthony's avatar
BAIRE Anthony committed
21 22 23 24 25 26 27 28 29 30 31 32
RUN apt-getq install	\
	binutils	\
	less		\
	nano		\
	ncurses-term	\
	netcat-openbsd	\
	openssh-client	\
	openssh-server	\
	procps		\
	rsync		\
	vim-gtk		\
	xauth
33

34 35 36 37 38 39 40
# overwrite the official packages with our patched packages openssh-{server,client}.deb
# Notes:
# - we put the 'hold' mark so that automatic upgrades will not replace them
# - we touch every installed files because as of stretch the debian builds are
#   reproducible (otherwise, because the timestamp of the package files is
#   identical when the package is rebuilt, docker would not detect the change
#   and would not install the new file in the resulting image
41
COPY --from=builder /src/*.deb /tmp/
42 43 44 45 46 47 48
RUN set -x -e;\
	for pkg in openssh-client openssh-server ; do		\
		dpkg -i "/tmp/$pkg.deb"				;\
		apt-mark hold "$pkg"				;\
		dpkg -L "$pkg" | xargs -d \\n touch		;\
		rm -f "/tmp/$pkg.deb"				;\
	done
49

50
COPY files/. /
51

BAIRE Anthony's avatar
BAIRE Anthony committed
52
CMD ["toolbox-update"]