Merge pull request #12 from cmehay/dockerfiles

Fix install dep and add Dockefiles
pull/13/head v0.4.7
Christophe Mehay 8 years ago committed by GitHub
commit 62ddbe3aaa

@ -0,0 +1,5 @@
*
!pyentrypoint
!setup.py
!README.md
!tests

@ -0,0 +1,17 @@
# Testing with python 2
FROM python:2
RUN pip install pytest six pyyaml jinja2 colorlog watchdog pytest-mock
RUN adduser --uid 1009 --system testuser
RUN addgroup --gid 1010 testgroup
ENV PYTHONPATH /opt/
ADD tests/test_template.yml.tpl /tmp/test_template.yml
ADD tests/test_template.yml.tpl /tmp/test_template2.yml.tpl
WORKDIR /opt/tests
CMD ["py.test", "--verbose", "-rw", "."]

@ -0,0 +1,17 @@
# Testing with python 3
FROM python:3
RUN pip3 install pytest six pyyaml jinja2 colorlog watchdog pytest-mock
RUN adduser --uid 1009 --system testuser
RUN addgroup --gid 1010 testgroup
ENV PYTHONPATH /opt/
ADD tests/test_template.yml.tpl /tmp/test_template.yml
ADD tests/test_template.yml.tpl /tmp/test_template2.yml.tpl
WORKDIR /opt/tests
CMD ["py.test", "--verbose", "-rw", "."]

@ -1,17 +1,12 @@
# Testing with python 2
FROM python:2
RUN pip install pytest six pyyaml jinja2 colorlog watchdog pytest-mock
RUN adduser --uid 1009 --system testuser
RUN addgroup --gid 1010 testgroup
ENV PYTHONPATH /opt/
ADD . /tmp/
ADD tests/test_template.yml.tpl /tmp/test_template.yml
ADD tests/test_template.yml.tpl /tmp/test_template2.yml.tpl
RUN cd /tmp && \
pip install --upgrade pip && \
python setup.py install && \
rm -rf *
WORKDIR /opt/tests
ONBUILD ADD entrypoint-config.yml .
CMD ["py.test", "--verbose", "-rw", "."]
ENTRYPOINT ["pyentrypoint"]

@ -0,0 +1,12 @@
FROM python:2-alpine
ADD . /tmp/
RUN cd /tmp && \
pip install --upgrade pip && \
python setup.py install && \
rm -rf *
ONBUILD ADD entrypoint-config.yml .
ENTRYPOINT ["pyentrypoint"]

@ -1,17 +1,12 @@
# Testing with python 3
FROM python:3
RUN pip3 install pytest six pyyaml jinja2 colorlog watchdog pytest-mock
RUN adduser --uid 1009 --system testuser
RUN addgroup --gid 1010 testgroup
ENV PYTHONPATH /opt/
ADD . /tmp/
ADD tests/test_template.yml.tpl /tmp/test_template.yml
ADD tests/test_template.yml.tpl /tmp/test_template2.yml.tpl
RUN cd /tmp && \
pip install --upgrade pip && \
python setup.py install && \
rm -rf *
WORKDIR /opt/tests
ONBUILD ADD entrypoint-config.yml .
CMD ["py.test", "--verbose", "-rw", "."]
ENTRYPOINT ["pyentrypoint"]

@ -0,0 +1,12 @@
FROM python:3-alpine
ADD . /tmp/
RUN cd /tmp && \
pip install --upgrade pip && \
python setup.py install && \
rm -rf *
ONBUILD ADD entrypoint-config.yml .
ENTRYPOINT ["pyentrypoint"]

@ -45,6 +45,22 @@ ENTRYPOINT ['pyentrypoint']
CMD ['git']
```
#### Using docker-image
```dockerfile
FROM goldy/pyentrypoint:python3
# ONBUILD statement add entrypoint-config.yml in current directories
```
Available with many flavours:
- `goldy/pyentrypoint:python2`
- `goldy/pyentrypoint:python3`
- `goldy/pyentrypoint:python2-alpine`
- `goldy/pyentrypoint:python3-alpine`
### Working examples
- [Tor hidden service](https://github.com/cmehay/docker-tor-hidden-service)

@ -1,6 +1,6 @@
testpython3:
build: .
dockerfile: Dockerfile.py3
dockerfile: Dockerfile-test.py3
volumes:
- ./pyentrypoint:/opt/pyentrypoint:ro
- ./tests:/opt/tests
@ -15,7 +15,7 @@ testpython3:
testpython2:
build: .
dockerfile: Dockerfile.py2
dockerfile: Dockerfile-test.py2
volumes:
- ./pyentrypoint:/opt/pyentrypoint:ro
- ./tests:/opt/tests
@ -30,7 +30,7 @@ testpython2:
testpython3_debug:
build: .
dockerfile: Dockerfile.py3
dockerfile: Dockerfile-test.py3
volumes:
- ./pyentrypoint:/opt/pyentrypoint:ro
- ./tests:/opt/tests
@ -46,7 +46,7 @@ testpython3_debug:
testpython2_debug:
build: .
dockerfile: Dockerfile.py2
dockerfile: Dockerfile-test.py2
volumes:
- ./pyentrypoint:/opt/pyentrypoint:ro
- ./tests:/opt/tests

@ -79,6 +79,8 @@ class Command(object):
self.log.debug('Now running: "{args}"'.format(
args='" "'.join(self.args)
))
if not self.args[0]:
raise Exception('Nothing to run')
os.execvpe(self.args[0], self.args, self.env)
def _run_reloader(self):

@ -5,7 +5,7 @@ from setuptools import setup
# Thanks Sam and Max
__version__ = '0.4.6'
__version__ = '0.4.7'
if __name__ == '__main__':
setup(
@ -27,7 +27,6 @@ if __name__ == '__main__':
install_requires=['Jinja2>=2.8',
'PyYAML>=3.11',
'colorlog>=2.6.1',
'argparse>=1.4.0',
'six>=1.10.0',
'watchdog>=0.8.3'],

Loading…
Cancel
Save