Skip to content

Commit

Permalink
[deps] Rebuild Dockerfile.ovm-tarball on top of Dockerfile.common
Browse files Browse the repository at this point in the history
- Slim down the image with --no-install-recommends
- Use the apt cache mount to speed up the build.

Note the python symlink step has to run as root.
  • Loading branch information
Andy C committed Sep 26, 2022
1 parent 113b293 commit a33aef0
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 23 deletions.
24 changes: 10 additions & 14 deletions deps/Dockerfile.ovm-tarball
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
FROM debian:buster-slim

RUN apt-get update

WORKDIR /home/uke/tmp

# Copy build scripts into the container and run them
FROM oilshell/soil-common

# Copy again to prevent unsound caching
COPY deps/from-apt.sh /home/uke/tmp/deps/from-apt.sh

RUN deps/from-apt.sh layer-for-soil

RUN deps/from-apt.sh ovm-tarball
# layer-locales also has to install packages
RUN --mount=type=cache,id=var-cache-apt,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=var-lib-apt,target=/var/lib/apt,sharing=locked \
du --si -s /var/cache/apt /var/lib/apt && \
deps/from-apt.sh layer-locales && \
deps/from-apt.sh ovm-tarball

RUN deps/from-apt.sh layer-python-symlink

RUN deps/from-apt.sh layer-locales

RUN useradd --create-home uke && chown -R uke /home/uke
USER uke

# TODO: Figure out a better way to handle deps?
# TODO: Optimize the size of Python 2.7, cmark, re2c, spec-bin

COPY Python-2.7.13/ /home/uke/tmp/Python-2.7.13/

COPY build/common.sh /home/uke/tmp/build/common.sh
Expand Down
23 changes: 15 additions & 8 deletions deps/from-apt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ layer-common() {
}

layer-locales() {
apt-get install -y locales
apt-install locales
# uncomment in a file
sed -i 's/# en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen
locale-gen --purge en_US.UTF-8
Expand Down Expand Up @@ -187,30 +187,37 @@ clang() {

ovm-tarball() {
local -a packages=(
# retrieving deps -- TODO: move to build time
wget
# for wget https://. TODO: remove when the build is hermetic
ca-certificates

# spec tests need the 'time' command, not the shell builtin
time
'time'

# This is a separate package needed for re2c. TODO: remove when we've
# built it into the image.
g++
# for cmark and yajl
cmake
# needed to build cmark (although we could use Ninja)
make

xz-utils # extract e.g. re2c tarball
bzip2 # extract e.g. busybox tarball

# line_input.so needs this
libreadline-dev
python2-dev

# retrieving deps -- TODO: move to build time
wget
# for syscall measurements
strace

# for cmark and yajl
cmake

# test/spec-runner.sh needs this
gawk
)

apt-get install -y "${packages[@]}"
apt-install "${packages[@]}"
}

if test $(basename $0) = 'from-apt.sh'; then
Expand Down
2 changes: 1 addition & 1 deletion deps/images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ build() {
tag() {
local name=${1:-dummy}

local tag='v-2022-09-24'
local tag='v-2022-09-25'
sudo docker tag oilshell/soil-$name:latest oilshell/soil-$name:$tag
}

Expand Down
4 changes: 4 additions & 0 deletions soil/host-shim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ live-image-tag() {
# soil-common and cache mount
echo 'v-2022-09-24'
;;
(ovm-tarball)
# soil-common and cache mount
echo 'v-2022-09-25'
;;
(clang)
# Updated with layer-py3
echo 'v-2022-08-05'
Expand Down

0 comments on commit a33aef0

Please sign in to comment.