-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (33 loc) · 1.28 KB
/
Copy pathDockerfile
File metadata and controls
43 lines (33 loc) · 1.28 KB
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
FROM python:3.11-alpine
LABEL org.opencontainers.image.source=https://github.com/sweeneytr/polymer
LABEL org.opencontainers.image.description="Polymer DB Server"
LABEL org.opencontainers.image.licenses=MIT
ARG APP_PATH=/opt/${APP_NAME}
ENV \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONFAULTHANDLER=1
# Don't cache PIP because that cache will bloat the final image
ENV \
PIP_NO_CACHE_DIR=true \
PIP_DISABLE_PIP_VERSION_CHECK=true
WORKDIR /opt/polymer
COPY /dist/*.whl ./
COPY requirements.txt ./
COPY alembic.ini ./
COPY alembic/ alembic/
COPY logging.yaml ./
# Install runtime dependencies
RUN apk --no-cache add libpq libstdc++
# Done as one command so we don't increase the size of the final image with the dev packages.
RUN apk --no-cache add git build-base gcc rust cargo musl-dev postgresql-dev libffi-dev \
&& pip install ./polymer*.whl --requirement requirements.txt \
&& apk del git build-base gcc rust cargo musl-dev postgresql-dev libffi-dev
RUN addgroup -S app --gid 8675 && adduser -S app --uid 3090 -G app
RUN chown -R app:app /opt/polymer
USER app
# export as environment variables for the CMD
ENV APP_NAME=polymer
EXPOSE 8080/tcp
ENTRYPOINT ["uvicorn", "polymer.app:app", "--proxy-headers", "--host=0.0.0.0", "--port=8080"]
CMD [ "--log-config=logging.yaml" ]