-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
67a9589
commit 9190a6c
Showing
2 changed files
with
37 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,40 @@ | ||
FROM python:3.9.5-alpine | ||
# Here is the build image | ||
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/* | ||
|
||
COPY . vwsfriend | ||
RUN python3.9 -m venv /opt/venv | ||
# Make sure we use the virtualenv: | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
WORKDIR ./vwsfriend/ | ||
RUN pip3 install --no-cache-dir wheel | ||
RUN pip3 install --no-cache-dir -r requirements.txt | ||
RUN pip3 install --no-cache-dir . | ||
|
||
#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= | ||
|
||
COPY . vwsfriend | ||
RUN apk add --no-cache --virtual .build-deps rust build-base gcc libc-dev libffi-dev musl-dev python3-dev libffi-dev openssl-dev cargo postgresql-dev && \ | ||
apk --no-cache add libpq && \ | ||
apk --no-cache add jpeg-dev \ | ||
zlib-dev \ | ||
freetype-dev \ | ||
lcms2-dev \ | ||
openjpeg-dev \ | ||
tiff-dev \ | ||
tk-dev \ | ||
tcl-dev | ||
RUN --mount=type=cache,target=/root/.cache \ | ||
pip install -r ./vwsfriend/requirements.txt && \ | ||
pip install -r ./vwsfriend/setup_requirements.txt && \ | ||
pip install -r ./vwsfriend/test_requirements.txt && \ | ||
pip install ./vwsfriend/ | ||
RUN apk del .build-deps | ||
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} |