Skip to content

Commit 9d8b892

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
container: parameterize the sambacc containerfile
Strip down the containerfile to the bare minimum, the base image, the build.sh script, and dependencies. Make the base image a build arg. Make the installation of the dependencies optional based on a build arg. This now makes it possible to more easily test and reuse the sambacc test (and build) container image for different base OSes. For example: ``` podman build -t sambacc:mini36 --build-arg=SAMBACC_BASE_IMAGE=registry.fedoraproject.org/fedora:36 --build-arg=SAMBACC_MINIMAL=yes -f tests/container/Containerfile podman run --rm -it sambacc:mini36 podman build -t sambacc:c9s -f tests/container/Containerfile podman build -t sambacc:mini9 --build-arg=SAMBACC_MINIMAL=yes -f tests/container/Containerfile podman build -t sambacc:fc37 --build-arg=SAMBACC_BASE_IMAGE=registry.fedoraproject.org/fedora:37 -f tests/container/Containerfile ``` Signed-off-by: John Mulligan <[email protected]>
1 parent 8389d63 commit 9d8b892

File tree

1 file changed

+11
-27
lines changed

1 file changed

+11
-27
lines changed

tests/container/Containerfile

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,14 @@
1-
FROM registry.fedoraproject.org/fedora:36
1+
ARG SAMBACC_BASE_IMAGE='registry.fedoraproject.org/fedora:36'
2+
FROM $SAMBACC_BASE_IMAGE
3+
24

3-
RUN yum install \
4-
-y --setopt=install_weak_deps=False \
5-
git \
6-
mercurial \
7-
python-pip \
8-
python-pip-wheel \
9-
python-setuptools \
10-
python-setuptools-wheel \
11-
python-tox \
12-
python3-samba \
13-
python3-wheel \
14-
python3-pyxattr \
15-
python3-devel \
16-
python3.9 \
17-
samba-common-tools \
18-
rpm-build \
19-
'python3dist(flake8)' \
20-
'python3dist(inotify-simple)' \
21-
'python3dist(mypy)' \
22-
'python3dist(pytest)' \
23-
'python3dist(pytest-cov)' \
24-
'python3dist(setuptools-scm)' \
25-
'python3dist(tox-current-env)' \
26-
'python3dist(wheel)' \
27-
&& yum clean all \
28-
&& true
295
COPY build.sh /usr/local/bin/build.sh
6+
7+
# Set SAMBACC_MINIMAL to yes to build a container that only contains the
8+
# build.sh script on top of the base image. When called, build.sh will
9+
# automatically install the dependency packages. Installing packages on every
10+
# run can be slow, especially if you are hacking on the code or tests, so we
11+
# install those dependencies proactively by default.
12+
ARG SAMBACC_MINIMAL=no
13+
RUN if [ "$SAMBACC_MINIMAL" != "yes" ]; then /usr/local/bin/build.sh --install ; fi
3014
ENTRYPOINT ["/usr/local/bin/build.sh"]

0 commit comments

Comments
 (0)