-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
63 lines (45 loc) · 1.63 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
FROM python:3.9 as base
MAINTAINER Benedikt Kristinsson <benedikt@lokun.is>
ENV DEBIAN_FRONTEND noninteractive
ENV TZ UTC
ENV TERM=xterm-256color
RUN useradd -u 1211 -ms /bin/bash zflux && \
mkdir /zflux && \
chown -R zflux. /zflux && \
apt-get update && \
apt-get install -y libzmq3-dev
RUN python -m pip install --upgrade pip
ENV PATH "/home/zflux/.local/bin:$PATH"
USER zflux
FROM base as builder
WORKDIR /zflux
RUN python -m pip install poetry
COPY .flake8 poetry.lock pyproject.toml /zflux/
RUN poetry install --no-interaction --ansi --no-root
# save the dependencies in a file so the
# final stage doesnt have to pip install them
# on each code change
RUN poetry export --without-hashes > /zflux/requirements.txt
COPY README.md /zflux/
COPY tests /zflux/tests/
COPY zflux /zflux/zflux/
COPY test-zflux-local.yml /zflux/test-zflux-local.yml
# should be in the jenkinsfile at some point
# this is shit
RUN poetry run pytest
RUN poetry run isort . --check || true
RUN poetry run flake8 || true
RUN poetry build --no-interaction --ansi
FROM base as final
COPY --from=builder /zflux/requirements.txt /zflux/
RUN python -m pip install -r /zflux/requirements.txt && \
rm -v /zflux/requirements.txt
# COPY --from=builder /zflux/dist/zflux-*.tar.gz /zflux/dist/
# COPY --from=builder /zflux/dist/zflux-*.whl /zflux/dist/
COPY --chown=zflux:zflux --from=builder /zflux/dist /zflux/dist/
# testing using the .whl file
RUN python -m pip install /zflux/dist/zflux-*.whl && \
rm -vrf /zlux/dist
HEALTHCHECK --start-period=5s --interval=15s --timeout=1s \
CMD zf_ruok || exit 1
ENTRYPOINT ["zflux"]