|
| 1 | +# |
| 2 | +# debian-awscli is a lightweight base image that has bash, python3 and the AWS CLI on board (for S3 access) |
| 3 | +# |
| 4 | +# We switched from Alpine to Debian for this image due to these two articles: |
| 5 | +# - https://pythonspeed.com/articles/base-image-python-docker-images/ |
| 6 | +# - https://pythonspeed.com/articles/alpine-docker-python/ |
| 7 | +# |
| 8 | +# TODO: Make this a multi-stage dockerfile, we don't need the full C compiler and all that in the base image! |
| 9 | +# |
| 10 | +FROM python:3.8-slim-buster |
| 11 | + |
| 12 | +ENV AWSCLI_VERSION="1.18.56" |
| 13 | + |
| 14 | +ENV PATH="/app/.local/bin:${PATH}" |
| 15 | + |
| 16 | +# |
| 17 | +# This hack is widely applied to avoid python printing issues in docker containers. |
| 18 | +# See: https://github.com/Docker-Hub-frolvlad/docker-alpine-python3/pull/13 |
| 19 | +# |
| 20 | +ENV PYTHONUNBUFFERED=1 |
| 21 | + |
| 22 | +# |
| 23 | +# The two lines below are there to prevent a red line error to be shown about apt-utils not being installed |
| 24 | +# |
| 25 | +ARG DEBIAN_FRONTEND=noninteractive |
| 26 | +SHELL ["/bin/bash", "-c"] |
| 27 | + |
| 28 | + |
| 29 | +RUN \ |
| 30 | + whoami && \ |
| 31 | + apt-get update && \ |
| 32 | + apt-get install -y --no-install-recommends apt-utils 2> >( grep -v 'since apt-utils is not installed' >&2 ) && \ |
| 33 | + apt-get install -y -qq less groff ca-certificates wget curl jq git rsync && \ |
| 34 | + pip install --upgrade pip && \ |
| 35 | + pip install awscli==$AWSCLI_VERSION && \ |
| 36 | + pip install rdflib && \ |
| 37 | + pip install git+https://github.com/rdflib/sparqlwrapper#egg=sparqlwrapper && \ |
| 38 | + pip install requests && \ |
| 39 | + pip install boto3 && \ |
| 40 | + pip install pystardog && \ |
| 41 | + apt-get autoremove --purge -y git && \ |
| 42 | + apt-get clean -y && \ |
| 43 | + rm -rf /app/.cache >/dev/null 2>&1 || true && \ |
| 44 | + mkdir -p /app/.aws |
| 45 | + |
| 46 | +WORKDIR /app/ |
| 47 | + |
| 48 | +ENTRYPOINT [ "/usr/local/bin/aws" ] |
0 commit comments