-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
69 lines (52 loc) · 1.92 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
64
65
66
67
68
69
FROM python:3.11-slim-buster as base
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random
FROM base as builder
ENV PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
PATH="~/.local/bin:/venv/bin:${PATH}" \
VIRTUAL_ENV="/venv" \
POETRY_VERSION=1.5.1 \
POETRY_VIRTUALENVS_CREATE=false
WORKDIR /app
SHELL ["/bin/bash", "-exo", "pipefail", "-c"]
RUN apt-get update \
&& apt-get install --no-install-recommends -y curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN curl -sSL https://install.python-poetry.org | python3 - --version ${POETRY_VERSION}
RUN python3 -m venv ${VIRTUAL_ENV}
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-dev --no-interaction --no-ansi --no-root
COPY . ./
RUN poetry install --no-interaction --no-ansi
FROM base as final
ARG REPOSITORY=https://github.com/ryankanno/py-golf-games
ARG BUILD_DATETIME
ARG VERSION
ARG REVISION
ARG BRANCH
ENV REPOSITORY ${REPOSITORY}
ENV BUILD_DATETIME ${BUILD_DATETIME:-null}
ENV VERSION ${VERSION:-null}
ENV REVISION ${REVISION:-null}
ENV BRANCH ${BRANCH:-main}
ENV PATH="/venv/bin:${PATH}" \
VIRTUAL_ENV="/venv" \
PYTHONPATH="/app"
LABEL maintainers="Ryan Kanno <ryankanno@localkinegrinds.com>"
LABEL org.opencontainers.image.created="${BUILD_DATETIME}" \
org.opencontainers.image.title="py-golf-games" \
org.opencontainers.image.description="Library to help simulate golf games" \
org.opencontainers.image.authors="ryankanno@localkinegrinds.com" \
org.opencontainers.image.revision="${REVISION}" \
org.opencontainers.image.source="${REPOSITORY}" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.licenses="MIT"
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
COPY --from=builder /app /app
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x '/docker-entrypoint.sh'
ENTRYPOINT ["/bin/bash", "/docker-entrypoint.sh"]