Skip to content

Instantly share code, notes, and snippets.

@mdaniel
Last active November 28, 2015 08:43
Show Gist options
  • Save mdaniel/4ecc3489e536625302e8 to your computer and use it in GitHub Desktop.
Save mdaniel/4ecc3489e536625302e8 to your computer and use it in GitHub Desktop.
Just what the filename says; I much prefer the "I can upgrade whenever I'd like" model to the "wait for the magic docker-hub version to rain down from our sentry.com overloads" version, what with it being an Open Source and on-premise model, and all that. Plus, mine is 327MB - without even trying to optimize it - and theirs is 837MB so ppfffttt.
FROM debian:jessie
# you are welcome to skip these, they just make cycle times faster
# plus, you'll need those libxml2-dev (etc) dependencies and about 15 minutes
# while it rebuilds everything from scratch
## ADD debian_jessie_var_cache_apt.tar /
# pip/wheels/2d/f6/d6/158b79cc088e551305968e312953c9767855a36f39d4e16054/lxml-3.5.0-cp27-none-linux_x86_64.whl
# just be aware that /root/.cache/pip
# must be owned by root or pip won't use them
## ADD root_cache_pip.linux.tar /root
# we don't use any decrepit version of pip shipped with debian
# it's fetched from bootstrap.pypa.io
# since we're installing from the local wheel, which we say "no-index"
# we need to explicitly add in the req fetches
ADD requirements.txt /tmp/requirements.txt
ADD dist/sentry-7.7.4-py2.py3-none-any.whl /tmp
# libffi-dev libssl-dev zlib1g-dev
# libxml2-dev libxslt-dev python-dev
# libpq-dev in case you need it
RUN export DEBIAN_FRONTEND=noninteractive; \
apt-get update \
&& if [ -d /root/.cache ]; then chown -R 0:0 /root/.cache; fi \
&& apt-get install -y build-essential curl \
libxml2 libxslt1.1 \
python-psycopg2 \
libffi-dev libssl-dev zlib1g-dev \
libxml2-dev libxslt-dev python-dev \
&& curl -sfLo /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py \
&& python -u /tmp/get-pip.py \
&& pip install -r /tmp/requirements.txt \
&& pip install --no-index --find-links /tmp sentry==7.7.4 \
&& apt-get purge -y build-essential \
libssl-dev libxml2-dev libxslt-dev zlib1g-dev \
python-dev \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt /var/apt/cache /root/.cache /tmp/*
VOLUME ["/root/.sentry"]
EXPOSE 9000
CMD ["/usr/local/bin/sentry", "start", "--noinput", "--verbosity=2"]
# consumers are responsible for "sentry", "upgrade" et al
# one may also use this same image for running the celery worker,
# ensuring only one --beat is active through dark magick
# CMD ["/usr/local/bin/sentry", "celery", "worker", "--beat"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment