$ docker build -t show .
$ docker run -v `pwd`:/data show /data/blah.txt
a
b
c
d
e
f
g
| a | |
| b | |
| c | |
| d | |
| e | |
| f | |
| g |
| FROM python:3.7 | |
| RUN mkdir -p /data | |
| COPY p.py /p.py | |
| RUN pip install click | |
| WORKDIR / | |
| ENTRYPOINT ["python", "p.py"] |
| import click | |
| @click.command() | |
| @click.argument('filename', type=click.Path(exists=True)) | |
| def show(filename): | |
| """Print FILENAME if the file exists.""" | |
| with open(filename, 'rb') as f: | |
| for l in f: | |
| click.echo((l), nl=False) | |
| if __name__ == '__main__': | |
| show() |