-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.api
52 lines (40 loc) · 1.53 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
52
FROM python:3.9.0-buster
RUN apt-get update
RUN pip install --upgrade pip
ENV APP_USER twilio
ENV FLASK_APP gordon
ENV APP_DIR /home/twilio/app/gordon
ENV APP_INSTALL_DIR /app/gordon
ENV GORDON_RUN_MODE api
###################################################
# Please configure the following environment variables before building the image
ENV GORDON_LOG_LEVEL ERROR
ENV GITHUB_API https://api.github.com
ENV JIRA_API https://<jira-server-url>/rest/api/2/project/
ENV PAGERDUTY_URL https://api.pagerduty.com/schedules/
####################################################
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 gordon $APP_INSTALL_DIR/gordon
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_AD_USER $APP_DIR/secrets/ad_user.json
ENV SECRET_PAGERDUTY_API_TOKEN $APP_DIR/secrets/pagerduty.json
RUN pip3 install -r $APP_INSTALL_DIR/requirements.txt
USER $APP_USER
RUN mkdir -p $APP_DIR
ADD --chown=twilio:twilio gordon $APP_DIR/gordon
ADD --chown=twilio:twilio bin $APP_DIR/bin
WORKDIR $APP_DIR
EXPOSE 9001
CMD (gunicorn -b 0.0.0.0:9001 --workers=5 "gordon:create_app()")