-
Notifications
You must be signed in to change notification settings - Fork 0
/
DockerfileAvengercon
61 lines (46 loc) · 1.72 KB
/
DockerfileAvengercon
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
FROM python:3.11-slim as requirements
WORKDIR /tmp
RUN mkdir -p requirements
RUN pip install --upgrade pip poetry
RUN poetry self add poetry-plugin-export
COPY ./pyproject.toml pyproject.toml
COPY ./poetry.lock poetry.lock
COPY ./scripts/export_poetry_to_req_txt.sh export_poetry_to_req_txt.sh
RUN chmod +x export_poetry_to_req_txt.sh
RUN ./export_poetry_to_req_txt.sh
FROM python:3.11-slim as base
# Ensure curl is available for healthcheck via curl
# The additional packages are to support compiling google-re python wheel with the C++
# library
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
# "Always combine RUN apt-get update with apt-get install in the same RUN statement."
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
curl
# gcc \
# g++ \
# libre2-dev \
# libpq-dev
# Add additional installations here with trailing `\` on each line \
# Cleanup the apt cache to reduce image size
RUN apt-get purge -y --auto-remove
RUN rm -rf /var/lib/apt/lists/*
RUN pip install --upgrade pip
ENV PYTHONPATH=./
EXPOSE 8883
FROM base as development
LABEL maintainer="Brent Stone <brent.j.stone2.mil@army.mil>"
WORKDIR /app
COPY --from=requirements /tmp/requirements/requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY ./entrypoints/start-reload.sh start-reload.sh
RUN chmod +x start-reload.sh
COPY ./entrypoints/prestart.sh prestart.sh
RUN chmod +x prestart.sh
COPY ./README.md README.md
COPY ./pyproject.toml pyproject.toml
COPY ./avengercon avengercon
RUN pip install /app
FROM development as production
# Remove pip's cache to reduce final image size
# https://pip.pypa.io/en/stable/topics/caching/#avoiding-caching
RUN pip cache purge