-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
61 lines (45 loc) · 1.4 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
# Base Image
FROM python:3.12-slim AS python-base
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PIP_NO_CACHE_DIR=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=on
ENV PIP_DEFAULT_TIMEOUT=100
ENV POETRY_VERSION=1.8.2
ENV POETRY_HOME="/opt/poetry"
ENV POETRY_NO_INTERACTION=1
ENV POETRY_VIRTUALENVS_CREATE=false
ENV VIRTUAL_ENV="/venv"
ENV PATH="$POETRY_HOME/bin:$VIRTUAL_ENV/bin:$PATH"
RUN python -m venv $VIRTUAL_ENV
WORKDIR /app
ENV PYTHONPATH="/app:$PYTHONPATH"
# Builder Image
FROM python-base AS builder-base
RUN apt-get update && \
apt-get install -y \
apt-transport-https \
gnupg \
ca-certificates \
build-essential \
git \
nano \
curl \
&& apt-get clean
# install poetry - respects $POETRY_VERSION & $POETRY_HOME
# The --mount will mount the buildx cache directory to where
# Poetry and Pip store their cache so that they can re-use it
RUN --mount=type=cache,target=/root/.cache \
curl -sSL https://install.python-poetry.org | python -
WORKDIR /app
COPY poetry.lock pyproject.toml ./
RUN --mount=type=cache,target=/root/.cache \
poetry install --without dev --no-root
# Production Image
FROM python-base AS production
ENV GHOSTFOLIO_BASE_URL="https://ghostfol.io"
COPY --from=builder-base $VIRTUAL_ENV $VIRTUAL_ENV
WORKDIR /app
# COPY poetry.lock pyproject.toml ./
COPY src/tastytrade_ghostfolio/ tastytrade_ghostfolio/
CMD ["python", "tastytrade_ghostfolio/main.py"]