-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
54 lines (41 loc) · 1.43 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
#
# BUILDER STAGE
#
FROM docker.io/library/python:3.9 as builder
RUN pip install --disable-pip-version-check poetry
WORKDIR /build
COPY . .
RUN poetry export --without-hashes -f requirements.txt > requirements.txt \
&& poetry build -f sdist
RUN mkdir packages \
&& pip download \
-r requirements.txt \
-d packages \
--disable-pip-version-check
#
# RELEASE STAGE
#
FROM docker.io/library/python:3.9-slim
LABEL org.opencontainers.image.title="Synse Server" \
org.opencontainers.image.source="https://github.com/vapor-ware/synse-server" \
org.opencontainers.image.url="https://github.com/vapor-ware/synse-server" \
org.opencontainers.image.vendor="Vapor IO" \
org.opencontainers.image.authors="[email protected]"
RUN groupadd -g 51453 synse \
&& useradd -u 51453 -g 51453 synse
RUN apt-get update && apt-get install -y --no-install-recommends \
tini curl \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /synse \
&& mkdir -p /etc/synse \
&& chown -R synse:synse /synse \
&& chown -R synse:synse /etc/synse
COPY --from=builder /build/dist/synse_server-*.tar.gz /synse/synse_server.tar.gz
COPY --from=builder /build/packages /pip-packages
COPY ./assets/favicon.ico /etc/synse/static/favicon.ico
WORKDIR synse
RUN pip install --no-index --find-links=/pip-packages /pip-packages/* \
&& pip install synse_server.tar.gz \
&& rm -rf /root/.cache
USER synse
ENTRYPOINT ["/usr/bin/tini", "--", "synse_server"]