-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (36 loc) · 1.38 KB
/
Dockerfile
File metadata and controls
48 lines (36 loc) · 1.38 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
44
45
46
47
48
FROM python:3.6-alpine3.9
# label the image with branch name and commit hash
LABEL maintainer="maciej.brencz@gmail.com"
ARG BRANCH="master"
ARG COMMIT=""
LABEL branch=${BRANCH}
LABEL commit=${COMMIT}
WORKDIR /opt/mike
# install dependencies
COPY setup.py .
COPY mycroft_holmes/__init__.py mycroft_holmes/
COPY mycroft_holmes/bin mycroft_holmes/bin
# @see https://leemendelowitz.github.io/blog/how-does-python-find-packages.html
# Python by default reads site packages from /usr/local/lib/python3.6/site-packages
# while apk install py3-lxml to /usr/lib/python3.6/site-packages
ENV PYTHONPATH /usr/local/lib/python3.6/site-packages:/usr/lib/python3.6/site-packages
RUN apk add --update --no-cache mariadb-connector-c py3-lxml \
&& apk add --no-cache --virtual .build-deps build-base automake autoconf libtool mariadb-dev libffi-dev yaml-dev \
&& pip install -e . \
&& apk del .build-deps \
&& pip list
# copy the rest of the files
COPY . .
# expose the HTTP port
EXPOSE 5000
# your custom config YAML should be mounted
# and MIKE_CONFIG env variable should point to it
ENV MIKE_CONFIG /opt/mike/example.yaml
ENV COMMIT_SHA=${COMMIT}
ENV COMMIT_BRANCH=${BRANCH}
# entrypoint script
RUN echo "gunicorn 'mycroft_holmes.app.app:setup_app()' --worker-class sync -b 0.0.0.0:5000 --workers 4 --access-logfile -" > entrypoint
# do not run as root
USER 65534
# run the app
CMD ["sh", "entrypoint"]