From 1513afc241ef57cd5a8729507f5d395b3f4e49c5 Mon Sep 17 00:00:00 2001 From: jota Date: Fri, 9 Jun 2017 04:20:25 +0200 Subject: [PATCH 1/2] feat: added Docker support --- .gitignore | 10 ++++++++++ Dockerfile | 23 +++++++++++++++++++++++ docker-compose.yml | 6 ++++++ docker-entrypoint.sh | 21 +++++++++++++++++++++ docker-pokedex | 3 +++ 5 files changed, 63 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100755 docker-entrypoint.sh create mode 100755 docker-pokedex diff --git a/.gitignore b/.gitignore index a950e86..db0d25d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,14 @@ *.egg-info pokedex.sqlite +pokedex.sqlite-journal whoosh-index +pip-selfcheck.json + +/bin +!/bin/edit-csv-as-yaml +!/bin/poupdate +!/bin/reset-postgresql-sequences +/local +/lib +/include diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7d01801 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM python:2.7-slim + +RUN echo "Upgrading distro..." && \ + apt-get update > /dev/null && \ + apt-get upgrade -y > /dev/null && \ + echo "Installing dependencies..." && \ + apt-get install -y git python-distribute > /dev/null && \ + pip install --no-cache-dir virtualenv psycopg2 pymysql > /dev/null && \ + echo "Optimizing space..." && \ + apt-get remove --purge -y software-properties-common > /dev/null && \ + apt-get autoremove -y > /dev/null && \ + apt-get clean > /dev/null && \ + apt-get autoclean > /dev/null && \ + echo -n > /var/lib/apt/extended_states && \ + rm -rf /var/lib/apt/lists/* && \ + rm -rf /usr/share/man/?? && \ + rm -rf /usr/share/man/??_* + +COPY ./docker-entrypoint.sh /docker-entrypoint +RUN chmod +x /docker-entrypoint + +ENTRYPOINT ["/docker-entrypoint"] +CMD ["status"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..dbe6a8e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,6 @@ +version: '3' +services: + pokedex: + build: ./ + volumes: + - ./:/project diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..bd3b694 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -e + +POKEDEX_DIR=${POKEDEX_DIR:-"/project"} + +cd ${POKEDEX_DIR} + +if [ ! -f "${POKEDEX_DIR}/bin/python" ] || [ ! -f "${POKEDEX_DIR}/bin/pokedex" ] ; then + echo "Building the bin/pokedex executable ..." + virtualenv $POKEDEX_DIR --python=python2 + bin/python setup.py develop +fi + +case "$1" in + "") bin/pokedex help + ;; + "exec") exec ${@:2} + ;; + *) bin/pokedex $@ + ;; +esac diff --git a/docker-pokedex b/docker-pokedex new file mode 100755 index 0000000..439be09 --- /dev/null +++ b/docker-pokedex @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +docker-compose run --rm pokedex "$@" \ No newline at end of file From 1cd35dad4998259702d3feef5c77446341374224 Mon Sep 17 00:00:00 2001 From: jota Date: Sun, 11 Jun 2017 21:06:50 +0200 Subject: [PATCH 2/2] added basic package.json for npm/yarn compatibility --- package.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..83a4a45 --- /dev/null +++ b/package.json @@ -0,0 +1,3 @@ +{ + "private": true +} \ No newline at end of file