Skip to content

Commit c91b169

Browse files
committed
Add some rudimentary docker packaging
This will help with test bootstrapping
1 parent 0e91e50 commit c91b169

4 files changed

Lines changed: 48 additions & 0 deletions

File tree

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ sdist: dist/$(NAME)-$(VERSION).tar.gz
3131
dist/$(NAME)-$(VERSION).tar.gz:
3232
$(DIST_PYTHON) setup.py sdist
3333

34+
image: dist
35+
docker build --rm=true -t $(IMAGE_NAME) -f ./packaging/docker/Dockerfile .
36+
3437
dev:
3538
pipenv install
3639

packaging/docker/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM centos:8
2+
3+
ADD https://github.com/krallin/tini/releases/download/v0.18.0/tini /bin/tini
4+
ADD packaging/docker/entrypoint.sh /bin/entrypoint
5+
ADD packaging/docker/receptor.conf /tmp/receptor.conf
6+
RUN yum install -y python36 python3-dateutil
7+
ADD dist/receptor-0.1.0-py2.py3-none-any.whl /tmp/receptor-0.1.0-py2.py3-none-any.whl
8+
RUN pip3 install /tmp/receptor-0.1.0-py2.py3-none-any.whl
9+
RUN mkdir -p /receptor && \
10+
chmod +x /bin/tini /bin/entrypoint && \
11+
rm -rf /var/cache/yum
12+
VOLUME /receptor
13+
ENV LANG=en_US.UTF-8
14+
ENV LANGUAGE=en_US:en
15+
ENV LC_ALL=en_US.UTF-8
16+
ENV HOME=/receptor
17+
EXPOSE 8888/tcp
18+
WORKDIR /receptor
19+
ENTRYPOINT ["entrypoint"]
20+
CMD ["receptor", "-c", "/receptor/receptor.conf", "node"]

packaging/docker/entrypoint.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
# In OpenShift, containers are run as a random high number uid
4+
# that doesn't exist in /etc/passwd, but Ansible module utils
5+
# require a named user. So if we're in OpenShift, we need to make
6+
# one before Ansible runs.
7+
if [ `id -u` -ge 500 ] || [ -z "${CURRENT_UID}" ]; then
8+
9+
cat << EOF > /tmp/passwd
10+
root:x:0:0:root:/root:/bin/bash
11+
receptor:x:`id -u`:`id -g`:,,,:/receptor:/bin/bash
12+
EOF
13+
14+
cat /tmp/passwd > /etc/passwd
15+
rm /tmp/passwd
16+
fi
17+
18+
if [ ! -f /receptor/receptor.conf ]; then
19+
cp /tmp/receptor.conf /receptor/receptor.conf
20+
fi
21+
22+
exec tini -- "${@}"

packaging/docker/receptor.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[default]
2+
data_dir=/receptor/data
3+
debug=True

0 commit comments

Comments
 (0)