-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
44 lines (36 loc) · 1.19 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
FROM python:3.9.6-alpine3.14
ARG CONNECT_CERT_PATH_BUILD_ARG="./local-config/connect"
ARG CONNECT_CONFIG_PATH_BUILD_ARG="./local-config/connect"
RUN apk update && \
apk add ca-certificates && \
apk add --no-cache build-base \
openssl \
python3-dev \
librdkafka-dev \
librdkafka \
libxml2-dev \
libxslt-dev
# install certificates
# copy certificates and keys
WORKDIR /usr/local/share/ca-certificates/
COPY $CONNECT_CERT_PATH_BUILD_ARG/*.pem ./
COPY $CONNECT_CERT_PATH_BUILD_ARG/*.key ./
RUN chmod 644 *.pem *.key
RUN update-ca-certificates
# configure the connect app
RUN addgroup -S lfh && adduser -S lfh -G lfh -h /home/lfh
WORKDIR /home/lfh/connect
RUN mkdir config && \
chown -R lfh:lfh /home/lfh/connect
# copy config files
COPY --chown=lfh:lfh $CONNECT_CERT_PATH_BUILD_ARG/nats-server.nk ./config/
COPY --chown=lfh:lfh Pipfile.lock logging.yaml ./
# configure application
COPY --chown=lfh:lfh ./connect ./connect
USER lfh
RUN python -m pip install --user --upgrade pip pipenv
RUN /home/lfh/.local/bin/pipenv sync
EXPOSE 5000
WORKDIR /home/lfh/connect
ENV PYTHONPATH="."
CMD ["/home/lfh/.local/bin/pipenv", "run", "python", "connect/main.py"]