Skip to content

Commit a67fc96

Browse files
ad-server: use sambacc to configure/control ad server container
Signed-off-by: John Mulligan <[email protected]>
1 parent ac818d1 commit a67fc96

File tree

3 files changed

+52
-6
lines changed

3 files changed

+52
-6
lines changed

images/ad-server/Containerfile

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,35 @@
1-
FROM registry.fedoraproject.org/fedora:34
1+
FROM quay.io/samba.org/sambacc:latest AS builder
2+
ARG SAMBACC_VER=master
3+
ARG SAMBACC_REPO=https://github.com/samba-in-kubernetes/sambacc
4+
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.
9+
RUN SAMBACC_DISTNAME=latest \
10+
/usr/local/bin/build.sh ${SAMBACC_VER} ${SAMBACC_REPO}
211

12+
FROM registry.fedoraproject.org/fedora:34
313
ARG INSTALL_PACKAGES_FROM=default
414
ARG SAMBA_SPECIFICS=
515

16+
MAINTAINER John Mulligan <[email protected]>
17+
618
COPY install-packages.sh /usr/local/bin/install-packages.sh
719
RUN /usr/local/bin/install-packages.sh "$INSTALL_PACKAGES_FROM"
820

9-
COPY provision.sh /usr/local/bin/provision.sh
10-
COPY run.sh /usr/local/bin/run.sh
11-
COPY populate.sh /usr/local/bin/populate.sh
21+
COPY --from=builder \
22+
/srv/dist/latest/sambacc-*.whl \
23+
/tmp/
24+
COPY install-sambacc.sh /usr/local/bin/install-sambacc.sh
25+
RUN /usr/local/bin/install-sambacc.sh \
26+
"/tmp" "/usr/local/share/sambacc/examples/addc.json"
27+
28+
29+
ENV SAMBACC_CONFIG="/etc/samba/container.json:/etc/samba/users.json"
30+
ENV SAMBA_CONTAINER_ID="demo"
31+
ENV SAMBA_SPECIFICS="$SAMBA_SPECIFICS"
32+
ENTRYPOINT ["samba-dc-container"]
33+
CMD ["run", "--setup=provision", "--setup=populate"]
1234

13-
ENV POPULATE=/usr/local/bin/populate.sh
14-
ENTRYPOINT ["/usr/local/bin/run.sh"]
35+
# vim:set syntax=dockerfile:

images/ad-server/install-packages.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ case "${install_packages_from}" in
2121
esac
2222

2323
dnf install --setopt=install_weak_deps=False -y \
24+
findutils \
25+
python-pip \
26+
python3-jsonschema \
27+
python3-samba \
2428
samba-dc \
2529
procps-ng \
2630
/usr/bin/smbclient

images/ad-server/install-sambacc.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
wheeldir="$1"
6+
container_json_file="$2"
7+
8+
wheeldir=/tmp
9+
wheel="$(find "${wheeldir}" -type f -name 'sambacc-*.whl')" \
10+
11+
if ! [ "$(echo "$wheel" | wc -l)" = 1 ]; then
12+
echo "more than one wheel file found"
13+
exit 1
14+
fi
15+
16+
pip install "$wheel"
17+
rm -f "$wheel"
18+
19+
if [ "$container_json_file" ]; then
20+
ln -sf "$container_json_file" /etc/samba/container.json
21+
fi

0 commit comments

Comments
 (0)