1- FROM python:2.7.16-slim-buster as sdist
2-
3- LABEL maintainer=
"[email protected] " 4- LABEL org.opencontainers.image.title="Sentry PyPI Wheel"
5- LABEL org.opencontainers.image.description="PyPI Wheel Builder for Sentry"
6- LABEL org.opencontainers.image.url="https://sentry.io/"
7- LABEL org.opencontainers.image.source="https://github.com/getsentry/sentry"
8- LABEL org.opencontainers.image.vendor="Functional Software, Inc."
9- LABEL org.opencontainers.image.authors=
"[email protected] " 10-
11- RUN apt-get update && apt-get install -y --no-install-recommends \
12- # Needed for GPG
13- dirmngr \
14- gnupg \
15- # Needed for fetching stuff
16- wget \
17- && rm -rf /var/lib/apt/lists/*
18-
19- # Fetch trusted keys
20- RUN for key in \
21- # gosu
22- B42F6819007F00F88E364FD4036A9C25BF357DD4 \
23- # tini
24- 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \
25- # Node - gpg keys listed at https://github.com/nodejs/node
26- 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
27- FD3A5288F042B6850C66B31F09FE44734EB7990E \
28- 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
29- DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
30- C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
31- B9AE9905FFD7803F25714661B63B535A4C206CA9 \
32- 77984A986EBC2AA786BC0F66B01FBB92821C587A \
33- 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
34- 4ED778F539E3634C779C87C6D7062848A1AB005C \
35- A48C2BEE680E841632CD4E44F07496B3EB3C1762 \
36- B9E2F5981AA6E0CD28160D9FF13993A75599653C \
37- ; do \
38- # TODO(byk): Replace the keyserver below w/ something owned by Sentry
39- gpg --batch --keyserver hkps://mattrobenolt-keyserver.global.ssl.fastly.net:443 --recv-keys "$key" ; \
40- done
41-
42- # grab gosu for easy step-down from root
43- ENV GOSU_VERSION 1.11
44- RUN set -x \
45- && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
46- && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
47- && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
48- && rm -r /usr/local/bin/gosu.asc \
49- && chmod +x /usr/local/bin/gosu
50-
51- # grab tini for signal processing and zombie killing
52- ENV TINI_VERSION 0.18.0
53- RUN set -x \
54- && wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini" \
55- && wget -O /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini.asc" \
56- && gpg --batch --verify /usr/local/bin/tini.asc /usr/local/bin/tini \
57- && rm /usr/local/bin/tini.asc \
58- && chmod +x /usr/local/bin/tini
59-
60- # Get and set up Node for front-end asset building
61- COPY .nvmrc /usr/src/sentry/
62- RUN cd /usr/src/sentry \
63- && export NODE_VERSION="$(cat .nvmrc)" \
64- && wget "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \
65- && wget "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
66- && gpg --batch --verify SHASUMS256.txt.asc \
67- && grep " node-v$NODE_VERSION-linux-x64.tar.gz\$ " SHASUMS256.txt.asc | sha256sum -c - \
68- && tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
69- && rm -r "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc
70-
71- ARG SOURCE_COMMIT
72- ENV SENTRY_BUILD=${SOURCE_COMMIT:-unknown}
73- LABEL org.opencontainers.image.revision=$SOURCE_COMMIT
74- LABEL org.opencontainers.image.licenses="https://github.com/getsentry/sentry/blob/${SOURCE_COMMIT:-master}/LICENSE"
75-
76- COPY . /usr/src/sentry/
77- RUN export YARN_CACHE_FOLDER="$(mktemp -d)" \
78- && cd /usr/src/sentry \
79- && python setup.py bdist_wheel \
80- && rm -r "$YARN_CACHE_FOLDER" \
81- && mv /usr/src/sentry/dist /dist
82-
831# This is the image to be run
842FROM python:2.7.16-slim-buster
853
@@ -92,97 +10,135 @@ LABEL org.opencontainers.image.source="https://github.com/getsentry/sentry"
9210LABEL org.opencontainers.image.vendor="Functional Software, Inc."
9311LABEL org.opencontainers.image.authors=
"[email protected] " 9412
95-
9613# add our user and group first to make sure their IDs get assigned consistently
9714RUN groupadd -r sentry && useradd -r -m -g sentry sentry
9815
99- COPY --from=sdist /usr/local/bin/gosu /usr/local/bin/tini /usr/local/bin/
16+ ENV GOSU_VERSION=1.11 \
17+ TINI_VERSION=0.18.0
18+
19+ RUN set -x \
20+ && buildDeps=" \
21+ dirmngr \
22+ gnupg \
23+ wget \
24+ " \
25+ && apt-get update && apt-get install -y --no-install-recommends $buildDeps \
26+ && rm -rf /var/lib/apt/lists/* \
27+ # Fetch trusted keys
28+ && for key in \
29+ # gosu
30+ B42F6819007F00F88E364FD4036A9C25BF357DD4 \
31+ # tini
32+ 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \
33+ ; do \
34+ # TODO(byk): Replace the keyserver below w/ something owned by Sentry
35+ gpg --batch --keyserver hkps://mattrobenolt-keyserver.global.ssl.fastly.net:443 --recv-keys "$key" ; \
36+ done \
37+ # grab gosu for easy step-down from root
38+ && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
39+ && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
40+ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
41+ && rm -r /usr/local/bin/gosu.asc \
42+ && chmod +x /usr/local/bin/gosu \
43+ # grab tini for signal processing and zombie killing
44+ && wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini" \
45+ && wget -O /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini.asc" \
46+ && gpg --batch --verify /usr/local/bin/tini.asc /usr/local/bin/tini \
47+ && rm /usr/local/bin/tini.asc \
48+ && chmod +x /usr/local/bin/tini \
49+ && apt-get purge -y --auto-remove $buildDeps
10050
10151# Sane defaults for pip
10252ENV PIP_NO_CACHE_DIR=off \
103- PIP_DISABLE_PIP_VERSION_CHECK=1 \
104- # Sentry config params
105- SENTRY_CONF=/etc/sentry \
106- SENTRY_FILESTORE_DIR=/var/lib/sentry/files \
107- # Disable some unused uWSGI features, saving dependencies
108- # Thank to https://stackoverflow.com/a/25260588/90297
109- UWSGI_PROFILE_OVERRIDE=ssl=false;xml=false;routing=false \
110- # UWSGI dogstatsd plugin
111- UWSGI_NEED_PLUGIN=/var/lib/uwsgi/dogstatsd
112-
113- COPY --from=sdist /dist/*.whl /tmp/dist/
53+ PIP_DISABLE_PIP_VERSION_CHECK=1 \
54+ # Sentry config params
55+ SENTRY_CONF=/etc/sentry \
56+ # Disable some unused uWSGI features, saving dependencies
57+ # Thank to https://stackoverflow.com/a/25260588/90297
58+ UWSGI_PROFILE_OVERRIDE=ssl=false;xml=false;routing=false \
59+ # UWSGI dogstatsd plugin
60+ UWSGI_NEED_PLUGIN=/var/lib/uwsgi/ dogstatsd
61+
62+ # Copy and install dependencies first to leverage Docker layer caching.
63+ COPY /dist/requirements.txt /tmp/dist/requirements.txt
11464RUN set -x \
115- && buildDeps="" \
116- # uwsgi
117- && buildDeps="$buildDeps \
118- gcc \
119- g++ \
120- wget \
121- " \
122- # maxminddb
123- && buildDeps="$buildDeps \
124- libmaxminddb-dev \
125- " \
126- # librabbitmq
127- && buildDeps="$buildDeps \
128- make \
129- " \
130- # xmlsec
131- && buildDeps="$buildDeps \
132- libxmlsec1-dev \
133- pkg-config \
134- " \
135- && apt-get update \
136- && apt-get install -y --no-install-recommends $buildDeps \
137- && pip install /tmp/dist/*.whl \
138- # Separate these due to https://git.io/fjyz6
139- # Otherwise librabbitmq will install the latest amqp version,
140- # violating kombu's amqp<2.0 constraint.
141- && pip install librabbitmq==1.6.1 \
142- && mkdir /tmp/uwsgi-dogstatsd \
143- && wget -O - https://github.com/eventbrite/uwsgi-dogstatsd/archive/filters-and-tags.tar.gz | \
144- tar -xzf - -C /tmp/uwsgi-dogstatsd --strip-components=1 \
145- && UWSGI_NEED_PLUGIN="" uwsgi --build-plugin /tmp/uwsgi-dogstatsd \
146- && mkdir -p /var/lib/uwsgi \
147- && mv dogstatsd_plugin.so /var/lib/uwsgi/ \
148- && rm -rf /tmp/dist /tmp/uwsgi-dogstatsd .uwsgi_plugins_builder \
149- && apt-get purge -y --auto-remove $buildDeps \
150- # We install run-time dependencies strictly after
151- # build dependencies to prevent accidental collusion.
152- # These are also installed last as they are needed
153- # during container run and can have the same deps w/
154- # build deps such as maxminddb.
155- && apt-get install -y --no-install-recommends \
156- # pillow
157- libjpeg-dev \
158- # rust bindings
159- libffi-dev \
160- # maxminddb bindings
161- libmaxminddb-dev \
162- # SAML needs these run-time
163- libxmlsec1-dev \
164- libxslt-dev \
165- # pyyaml needs this run-time
166- libyaml-dev \
167- # other
168- pkg-config \
169- \
170- && apt-get clean \
171- && rm -rf /var/lib/apt/lists/* \
172- && python -c 'import librabbitmq' \
173- # Fully verify that the C extension is correctly installed, it unfortunately
174- # requires a full check into maxminddb.extension.Reader
175- && python -c 'import maxminddb.extension; maxminddb.extension.Reader' \
176- && mkdir -p $SENTRY_CONF && mkdir -p $SENTRY_FILESTORE_DIR
177-
178- COPY ./docker/docker-entrypoint.sh ./docker/sentry.conf.py ./docker/config.yml $SENTRY_CONF/
65+ && buildDeps="" \
66+ # uwsgi
67+ && buildDeps="$buildDeps \
68+ gcc \
69+ g++ \
70+ wget \
71+ " \
72+ # maxminddb
73+ && buildDeps="$buildDeps \
74+ libmaxminddb-dev \
75+ " \
76+ # librabbitmq
77+ && buildDeps="$buildDeps \
78+ make \
79+ " \
80+ # xmlsec
81+ && buildDeps="$buildDeps \
82+ libxmlsec1-dev \
83+ pkg-config \
84+ " \
85+ && apt-get update \
86+ && apt-get install -y --no-install-recommends $buildDeps \
87+ && pip install -r /tmp/dist/requirements.txt \
88+ # Separate these due to https://git.io/fjyz6
89+ # Otherwise librabbitmq will install the latest amqp version,
90+ # violating kombu's amqp<2.0 constraint.
91+ && pip install librabbitmq==1.6.1 \
92+ && mkdir /tmp/uwsgi-dogstatsd \
93+ && wget -O - https://github.com/eventbrite/uwsgi-dogstatsd/archive/filters-and-tags.tar.gz | \
94+ tar -xzf - -C /tmp/uwsgi-dogstatsd --strip-components=1 \
95+ && UWSGI_NEED_PLUGIN="" uwsgi --build-plugin /tmp/uwsgi-dogstatsd \
96+ && mkdir -p /var/lib/uwsgi \
97+ && mv dogstatsd_plugin.so /var/lib/uwsgi/ \
98+ && rm -rf /tmp/dist /tmp/uwsgi-dogstatsd .uwsgi_plugins_builder \
99+ && apt-get purge -y --auto-remove $buildDeps \
100+ # We install run-time dependencies strictly after
101+ # build dependencies to prevent accidental collusion.
102+ # These are also installed last as they are needed
103+ # during container run and can have the same deps w/
104+ # build deps such as maxminddb.
105+ && apt-get install -y --no-install-recommends \
106+ # pillow
107+ libjpeg-dev \
108+ # rust bindings
109+ libffi-dev \
110+ # maxminddb bindings
111+ libmaxminddb-dev \
112+ # SAML needs these run-time
113+ libxmlsec1-dev \
114+ libxslt-dev \
115+ # pyyaml needs this run-time
116+ libyaml-dev \
117+ # other
118+ pkg-config \
119+ \
120+ && apt-get clean \
121+ && rm -rf /var/lib/apt/lists/* \
122+ && python -c 'import librabbitmq' \
123+ # Fully verify that the C extension is correctly installed, it unfortunately
124+ # requires a full check into maxminddb.extension.Reader
125+ && python -c 'import maxminddb.extension; maxminddb.extension.Reader' \
126+ && mkdir -p $SENTRY_CONF
127+
128+ COPY /dist/*.whl /tmp/dist/
129+ RUN pip install /tmp/dist/*.whl && pip check && rm -rf /tmp/dist
130+ RUN sentry help | sed '1,/Commands:/d' | awk '{print $1}' > /sentry-commands.txt
131+
132+ COPY ./docker/sentry.conf.py ./docker/config.yml $SENTRY_CONF/
133+ COPY ./docker/docker-entrypoint.sh /
179134
180135EXPOSE 9000
181- VOLUME /var/lib/sentry/files
136+ VOLUME /data
182137
183- ENTRYPOINT exec $SENTRY_CONF /docker-entrypoint.sh $0 $@
138+ ENTRYPOINT exec /docker-entrypoint.sh $0 $@
184139CMD ["run" , "web" ]
185140
186141ARG SOURCE_COMMIT
142+ ENV SENTRY_BUILD=${SOURCE_COMMIT:-unknown}
187143LABEL org.opencontainers.image.revision=$SOURCE_COMMIT
188144LABEL org.opencontainers.image.licenses="https://github.com/getsentry/sentry/blob/${SOURCE_COMMIT:-master}/LICENSE"
0 commit comments