Skip to content

Commit 2a4c913

Browse files
server: make Containerfile capable of building default or nightly
Incorporate the new shell scripts into the container build file and use them, along with a few new build args to construct a container image based on the given build parameters. These parameters mean that the single Containerfile can build with our default set of samba packages or the nightly builds. Extending this is a matter of extending the shell scripts and calling the build command with the proper build args. Signed-off-by: John Mulligan <[email protected]>
1 parent c5d65c8 commit 2a4c913

File tree

1 file changed

+12
-25
lines changed

1 file changed

+12
-25
lines changed

images/server/Containerfile

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,29 @@ FROM quay.io/samba.org/sambacc:latest AS builder
22
ARG SAMBACC_VER=master
33
ARG SAMBACC_REPO=https://github.com/samba-in-kubernetes/sambacc
44

5-
# the changeset hash on the next line ensures we get a specifc
6-
# version of sambacc. When sambacc actually gets tagged, it should
7-
# be changed to use the tag.
5+
# The SAMBACC_VER value controls what version of sambacc we'll be building.
6+
# This can be a branch name, a tag, or a version hash. When building tagged
7+
# versions of samba-containers we should use a sambacc tag.
8+
# SAMBACC_DISTNAME controls where the script will output a built wheel.
89
RUN SAMBACC_DISTNAME=latest \
910
/usr/local/bin/build.sh ${SAMBACC_VER} ${SAMBACC_REPO}
1011

1112
FROM registry.fedoraproject.org/fedora:34
13+
ARG INSTALL_PACKAGES_FROM=default
14+
ARG SAMBA_SPECIFICS=
1215

1316
MAINTAINER John Mulligan <[email protected]>
1417

1518
COPY smb.conf /etc/samba/smb.conf
16-
RUN dnf install --setopt=install_weak_deps=False -y \
17-
findutils \
18-
python-pip \
19-
python3-jsonschema \
20-
python3-samba \
21-
samba \
22-
samba-client \
23-
samba-winbind \
24-
samba-winbind-clients \
25-
tdb-tools \
26-
ctdb \
27-
&& dnf clean all \
28-
&& cp --preserve=all /etc/ctdb/functions /usr/share/ctdb/functions \
29-
&& cp --preserve=all /etc/ctdb/notify.sh /usr/share/ctdb/notify.sh \
30-
&& true
19+
COPY install-packages.sh /usr/local/bin/install-packages.sh
20+
RUN /usr/local/bin/install-packages.sh "$INSTALL_PACKAGES_FROM"
3121

3222
COPY --from=builder \
3323
/srv/dist/latest/sambacc-*.whl \
3424
/tmp/
35-
RUN true \
36-
&& wheel="$(find /tmp/ -type f -name 'sambacc-*.whl')" \
37-
&& [ $(echo "$wheel" | wc -l) = 1 ] \
38-
&& pip install "$wheel" \
39-
&& rm -f "$wheel" \
40-
&& ln -s /usr/local/share/sambacc/examples/minimal.json /etc/samba/container.json \
41-
&& true
25+
COPY install-sambacc.sh /usr/local/bin/install-sambacc.sh
26+
RUN /usr/local/bin/install-sambacc.sh \
27+
"/tmp" "/usr/local/share/sambacc/examples/minimal.json"
4228

4329

4430
VOLUME ["/share"]
@@ -47,6 +33,7 @@ EXPOSE 445
4733

4834
ENV SAMBACC_CONFIG="/etc/samba/container.json:/etc/samba/users.json"
4935
ENV SAMBA_CONTAINER_ID="demo"
36+
ENV SAMBA_SPECIFICS="$SAMBA_SPECIFICS"
5037
ENTRYPOINT ["samba-container"]
5138
CMD ["run", "smbd"]
5239

0 commit comments

Comments
 (0)