# Pull Python 3.8.1 on alpine
FROM python:3.8.1-alpine
RUN apk --no-cache add gcc \
musl-dev \
python3-dev \
g++ \
libxslt-dev
# Create a new user to run as and set the working directory
ENV USER=twitter_media_tool
ENV UID=991
ENV GID=991
RUN addgroup -g "${GID}" twitter_media_tool
RUN adduser \
--disabled-password \
--gecos "" \
--home "/home/twitter_media_tool" \
--ingroup "${USER}" \
--uid "${UID}" \
"${USER}"
USER twitter_media_tool
WORKDIR /home/twitter_media_tool/
ENV PATH="${PATH}:/home/twitter_media_tool/.local/bin"
COPY Pipfile Pipfile
RUN pip install pipenv
RUN pipenv install Pipfile
COPY twitter_media_tool.py twitter_media_tool.py
ENTRYPOINT [ "pipenv", "run", "python", "twitter_media_tool.py" ]