-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
60 lines (43 loc) · 1.8 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
# SPDX-FileCopyrightText: 2022 Carnegie Mellon University
# SPDX-License-Identifier: MIT
FROM python:3.10-slim as base
LABEL org.opencontainers.image.description='Discovery and deployment for edge-native applications' \
org.opencontainers.image.source='https://github.com/cmusatyalab/sinfonia' \
org.opencontainers.image.vendor='Carnegie Mellon University' \
org.opencontainers.image.licenses='MIT'
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONFAULTHANDLER=1 \
PYTHONHASHSEED=random \
PYTHONUNBUFFERED=1
WORKDIR /app
FROM base as builder
ENV KUBECTL_VERSION=v1.23.2 \
HELM_VERSION=v3.8.0
RUN apt-get update && apt-get install --no-install-recommends -y curl git \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* \
&& curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl" \
&& chmod +x kubectl && mv kubectl /usr/local/bin/kubectl \
&& curl -LO "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz" \
&& tar -xf "helm-${HELM_VERSION}-linux-amd64.tar.gz" linux-amd64/helm \
&& chmod +x linux-amd64/helm && mv linux-amd64/helm /usr/local/bin/helm \
&& rm -rf "helm-${HELM_VERSION}-linux-amd64.tar.gz" linux-amd64
ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
POETRY_VERSION=1.2.2 \
POETRY_NO_INTERACTION=1
RUN pip install "poetry==$POETRY_VERSION" \
&& python -m venv /venv
COPY pyproject.toml poetry.lock ./
RUN poetry export -f requirements.txt | /venv/bin/pip install --no-deps -r /dev/stdin
COPY src ./src
COPY tests ./tests
RUN poetry build && /venv/bin/pip install dist/*.whl
FROM base as final
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /venv /venv
COPY RECIPES /RECIPES
VOLUME ["/RECIPES"]
ENV SINFONIA_RECIPES=/RECIPES
EXPOSE 5000
ENTRYPOINT ["/venv/bin/sinfonia-tier2"]