diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3b70711 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM python:3.7-alpine + +RUN apk add --no-cache gcc musl-dev + +WORKDIR /usr/src/app + +COPY requirements.txt ./ +RUN pip install -r requirements.txt --force-reinstall --no-cache-dir + +COPY ./entrypoint.sh . + +COPY . . + +RUN ["chmod", "+x", "./entrypoint.sh"] + +RUN python setup.py install + +CMD [ "./entrypoint.sh" ] \ No newline at end of file diff --git a/README.rst b/README.rst index 074f0c4..5798e45 100644 --- a/README.rst +++ b/README.rst @@ -42,6 +42,13 @@ Print help -t TIMEOUT, --timeout TIMEOUT Request timeout +Docker +####### +:: +docker build -t pyebox . +:: +docker run -e PYEBOX_MYACCOUNT=*** -e PYEBOX_MYPASSWORD=*** pyebox + Dev env ####### diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..db49381 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# Check user and password +if [ -z "$PYEBOX_MYACCOUNT" ] || [ -z "$PYEBOX_MYPASSWORD" ] +then + echo 'Error: No user or password. Set both environnement variables PYEBOX_MYACCOUNT and PYEBOX_MYPASSWORD' + exit 1 +else + pyebox -u $PYEBOX_MYACCOUNT -p $PYEBOX_MYPASSWORD +fi