Skip to content

Commit

Permalink
dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
tillsteinbach committed Aug 23, 2021
1 parent 9190a6c commit a38ae8e
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions vwsfriend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
# Here is the build image
FROM python:3.8.0-slim as builder
RUN apt-get update \
&& apt-get install gcc libpq-dev python-dev -y \
&& apt-get clean
RUN python -m venv /opt/venv
FROM ubuntu:20.04 as builder

ENV DEBIAN_FRONTEND="noninteractive"
ENV TZ="Etc/UTC"

RUN apt-get update && apt-get install --no-install-recommends -y python3.9 python3.9-dev python3.9-venv python3-pip python3-wheel build-essential && \
apt-get clean && rm -rf /var/lib/apt/lists/*

RUN python3.9 -m venv /opt/venv
# Make sure we use the virtualenv:
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install vwsfriend
RUN pip3 install --no-cache-dir wheel
RUN pip3 install --no-cache-dir vwsfriend

FROM python:3.9.6-slim-buster
#RUN python setup.py install

FROM ubuntu:20.04 AS runner-image

ENV WECONNECT_USER=
ENV WECONNECT_PASSWORD=
ENV WECONNECT_INTERVAL=
ENV ADDITIONAL_PARAMETERS=
ENV DATABASE_URL=

RUN apt-get update && apt-get install --no-install-recommends -y python3.9 python3-venv && \
apt-get clean && rm -rf /var/lib/apt/lists/*

COPY --from=builder /opt/venv /opt/venv
ENV VIRTUAL_ENV=/opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN mkdir -p /config

# make sure all messages always reach console
ENV PYTHONUNBUFFERED=1

CMD vwsfriend --username ${WECONNECT_USER} --password ${WECONNECT_PASSWORD} --interval ${WECONNECT_INTERVAL} --database-url ${DATABASE_URL} --config-dir /config ${ADDITIONAL_PARAMETERS}

0 comments on commit a38ae8e

Please sign in to comment.