-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (33 loc) · 1.22 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
FROM python:3.6-slim-stretch as python-requirements
COPY ./Pipfile ./Pipfile.lock /pingbot/
WORKDIR /pingbot
RUN \
pip install pipenv && \
pipenv lock -r > /requirements.txt
FROM python:3.6-slim-stretch as build-backend
COPY ./ /pingbot/
WORKDIR /pingbot
RUN \
find ./ ! -name '*.py' -type f -exec rm '{}' ';' && \
rm -rf tests/ .vscode/ .pytest_cache/ __pycache__/ && \
python3.6 -m compileall -b ./ && \
find ./ -name '*.py' -exec rm '{}' ';'
FROM python:3.6-slim-stretch
ARG VERSION
ARG VCS_REF
ARG BUILD_DATE
LABEL org.label-schema.vendor="Grafolean" \
org.label-schema.url="https://grafolean.com/" \
org.label-schema.name="Grafolean Ping bot" \
org.label-schema.description="ICMP Ping bot for Grafolean" \
org.label-schema.version=$VERSION \
org.label-schema.vcs-url="https://github.com/grafolean/grafolean-ping-bot/" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.docker.schema-version="1.0"
COPY --from=python-requirements /requirements.txt /requirements.txt
RUN pip install --no-cache-dir -r /requirements.txt
COPY --from=build-backend /pingbot/ /pingbot/
WORKDIR /pingbot
USER root
CMD ["python", "-m", "pingbot"]