Skip to content

Commit 78c0c94

Browse files
chriswmackeyChris Mackey
authored andcommitted
fic(ci): Add Docker image with all dependencies
1 parent 33fdf5d commit 78c0c94

File tree

6 files changed

+72
-2
lines changed

6 files changed

+72
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ jobs:
6060
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6161
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
6262
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
63+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
64+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
6365
- name: sleep for 5 minutes for PyPI update
6466
if: contains(steps.new_release.outputs.tag, '.')
6567
run: sleep 300s

.releaserc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[
77
"@semantic-release/exec",
88
{
9-
"publishCmd": "bash deploy.sh"
9+
"publishCmd": "bash deploy.sh ${nextRelease.version}"
1010
}
1111
]
1212
]

Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM python:3.7-slim
2+
3+
LABEL maintainer="Ladybug Tools" email="info@ladybug.tools"
4+
5+
ENV HOMEDIR='/home/ladybugbot'
6+
ENV PATH="${HOMEDIR}/.local/bin:${PATH}"
7+
ENV LIBRARYDIR="${HOMEDIR}/lib"
8+
ENV RUNDIR="${HOMEDIR}/run"
9+
10+
RUN apt-get update \
11+
&& apt-get -y install --no-install-recommends git \
12+
&& apt-get clean \
13+
&& rm -rf /var/lib/apt/lists/*
14+
15+
# Create non-root user
16+
RUN adduser ladybugbot --uid 1000 --disabled-password --gecos ""
17+
USER ladybugbot
18+
WORKDIR ${HOMEDIR}
19+
RUN mkdir ladybug_tools && touch ladybug_tools/config.json
20+
21+
# Install lbt-honeybee
22+
COPY honeybee_display ${LIBRARYDIR}/honeybee_display
23+
COPY .git ${LIBRARYDIR}/.git
24+
COPY setup.py ${LIBRARYDIR}
25+
COPY setup.cfg ${LIBRARYDIR}
26+
COPY requirements.txt ${LIBRARYDIR}
27+
COPY README.md ${LIBRARYDIR}
28+
COPY LICENSE ${LIBRARYDIR}
29+
30+
USER root
31+
RUN pip3 install --no-cache-dir setuptools wheel\
32+
&& pip3 install --no-cache-dir ${LIBRARYDIR}[full] \
33+
&& apt-get -y --purge remove git \
34+
&& apt-get -y clean \
35+
&& apt-get -y autoremove \
36+
&& rm -rf ${LIBRARYDIR}/.git
37+
38+
USER ladybugbot
39+
# Set up working directory
40+
RUN mkdir -p ${RUNDIR}/simulation
41+
WORKDIR ${RUNDIR}

deploy.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
#!/bin/sh
22

3+
if [ -n "$1" ]
4+
then
5+
NEXT_RELEASE_VERSION=$1
6+
else
7+
echo "A release version must be supplied"
8+
exit 1
9+
fi
10+
11+
CONTAINER_NAME="ladybugtools/honeybee-display"
12+
13+
echo "PyPi Deployment..."
314
echo "Building distribution"
415
python setup.py sdist bdist_wheel
516
echo "Pushing new version to PyPi"
617
twine upload dist/* -u $PYPI_USERNAME -p $PYPI_PASSWORD
18+
19+
20+
echo "Docker Deployment..."
21+
echo "Login to Docker"
22+
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
23+
24+
docker build . -t $CONTAINER_NAME:$NEXT_RELEASE_VERSION
25+
docker tag $CONTAINER_NAME:$NEXT_RELEASE_VERSION $CONTAINER_NAME:latest
26+
27+
docker push $CONTAINER_NAME:latest
28+
docker push $CONTAINER_NAME:$NEXT_RELEASE_VERSION

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
ladybug-display>=0.6.4
1+
ladybug-display>=0.6.6
22
honeybee-core>=1.54.2

setup.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
with open('requirements.txt') as f:
77
requirements = f.read().splitlines()
88

9+
full_requirements = ['honeybee-energy', 'honeybee-radiance', 'ladybug-vtk']
10+
911
setuptools.setup(
1012
name="honeybee-display",
1113
use_scm_version=True,
@@ -18,6 +20,9 @@
1820
url="https://github.com/ladybug-tools/honeybee-display",
1921
packages=setuptools.find_packages(exclude=["tests*"]),
2022
install_requires=requirements,
23+
extras_require={
24+
'full': full_requirements
25+
},
2126
entry_points={
2227
"console_scripts": ["honeybee-display = honeybee_display.cli:display"]
2328
},

0 commit comments

Comments
 (0)