-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathDockerfile.api
51 lines (40 loc) · 1.51 KB
/
Dockerfile.api
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
FROM python:3.9.0-buster
RUN apt-get update
RUN pip install --upgrade pip
ENV APP_USER twilio
ENV FLASK_APP deadshot
ENV APP_DIR /home/twilio/app/deadshot
ENV APP_INSTALL_DIR /app/deadshot
ENV DEADSHOT_RUN_MODE api
###################################################
# Please configure the following environment variables before building the image
ENV DEADSHOT_LOG_LEVEL DEBUG
ENV GITHUB_URL <github-url-without-scheme-or-port>
ENV GITHUB_API https://<github-url>/api/v3
ENV JIRA_SERVER=https://<jira-url>>.com
ENV GITHUB_APP_NAME deadshot[bot]
####################################################
ENV CELERY_BROKER_HOST redis
ENV CELERY_BROKER_PORT 6379
ENV CELERY_BROKER_DATABASE 1
RUN mkdir -p /home/twilio
RUN groupadd -r twilio &&\
useradd -r -g twilio -d /home/twilio -s /sbin/nologin -c "Twilio Docker image user" twilio
RUN chown twilio /home/twilio
RUN chgrp twilio /home/twilio
RUN mkdir -p $APP_INSTALL_DIR
COPY deadshot $APP_INSTALL_DIR/deadshot
COPY bin $APP_INSTALL_DIR/bin
COPY local_dev_secrets $APP_DIR/secrets
COPY requirements.txt $APP_INSTALL_DIR
ENV SECRET_GITHUB_SECRET $APP_DIR/secrets/github_secrets.json
ENV SECRET_SLACK_WEBHOOKS $APP_DIR/secrets/slack_webhook.json
ENV SECRET_JIRA_AUTH $APP_DIR/secrets/jira_user.json
RUN pip3 install -r $APP_INSTALL_DIR/requirements.txt
USER $APP_USER
RUN mkdir -p $APP_DIR
ADD --chown=twilio:twilio deadshot $APP_DIR/deadshot
ADD --chown=twilio:twilio bin $APP_DIR/bin
WORKDIR $APP_DIR
EXPOSE 9001
CMD (gunicorn -b 0.0.0.0:9001 --workers=5 "deadshot:create_app()")