Skip to content

Commit e9fd34c

Browse files
committed
add python package script
1 parent dfd7492 commit e9fd34c

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
docker push developmentseed/geolambda:latest
4343
docker push developmentseed/geolambda:${VERSION}
4444
cd python
45-
docker build --build-arg VERSION=${VERSION} --build-arg PYVER=3.6.1 . -t developmentseed/geolambda:${VERSION}-python36
45+
docker build --build-arg VERSION=${VERSION} --build-arg PYVERSION=3.6.1 . -t developmentseed/geolambda:${VERSION}-python36
4646
docker push developmentseed/geolambda:${VERSION}-python36
4747
cd ..
4848
# deploy public Lambda layers

python/Dockerfile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,26 @@ FROM developmentseed/geolambda:${VERSION}
33

44
LABEL maintainer="Matthew Hanson <matt.a.hanson@gmail.com>"
55

6-
ARG PYVER=3.6.1
6+
ARG PYVERSION=3.6.1
77

88
# install Python
99
ENV \
1010
PYENV_ROOT=/root/.pyenv \
1111
PATH=/root/.pyenv/shims:/root/.pyenv/bin:$PATH
1212

1313
RUN \
14+
PYMINVER=${PYVER} \
15+
export PYVER=${PYVER%%.*}${PYMINVER#*.} \
1416
echo PYVER ${PYVER}; \
1517
curl https://pyenv.run | bash; \
16-
pyenv install ${PYVER}; \
17-
pyenv global ${PYVER}; \
18+
pyenv install ${PYVERSION}; \
19+
pyenv global ${PYVERSION}; \
1820
pip install --upgrade pip
1921

2022
COPY requirements*.txt ./
2123

2224
RUN \
23-
pip isntall -r requirements-pre.txt; \
24-
pip install -r requirements.txt
25+
pip install -r requirements-pre.txt; \
26+
pip install -r requirements.txt
27+
28+
COPY bin/* /usr/local/bin/

python/bin/package-python.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# directory used for deployment
4+
export DEPLOY_DIR=lambda
5+
6+
echo Creating deploy package
7+
8+
EXCLUDE="boto3* botocore* pip* docutils* *.pyc setuptools* wheel* coverage* testfixtures* mock* *.egg-info *.dist-info"
9+
10+
EXCLUDES=()
11+
for E in ${EXCLUDE}
12+
do
13+
echo ${E}
14+
EXCLUDES+=("--exclude ${E} ")
15+
done
16+
17+
rsync -ax $PREFIX/lib/python$PYVER/site-packages/ $DEPLOY_DIR/ ${EXCLUDES[@]}
18+
rsync -ax $PREFIX/lib64/python$PYVER/site-packages/ $DEPLOY_DIR/ ${EXCLUDES[@]}
19+
20+
# zip up deploy package
21+
cd $DEPLOY_DIR
22+
zip -ruq ../lambda-deploy.zip ./

0 commit comments

Comments
 (0)