Created
May 6, 2017 12:17
-
-
Save agronholm/5787088e4bed458a46bfb5f41fabc330 to your computer and use it in GitHub Desktop.
Slimmer pypy3 dockerfile for crossbar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:jessie | |
ARG CROSSBAR_VERSION | |
ARG PYPY_VERSION=5.7.1 | |
ARG PYPY_SHA256SUM=2abaa54d88c9b70b64c37083e7e430a1d3a8f78f8de92e484a988b7aca1e50a7 | |
# install dependencies and Crossbar.io | |
RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends \ | |
ca-certificates \ | |
curl \ | |
expat \ | |
build-essential \ | |
libssl-dev | |
# install PyPy3 from upstream tarball | |
RUN curl -L --output /tmp/pypy.tar.bz2 https://bitbucket.org/pypy/pypy/downloads/pypy3-v${PYPY_VERSION}-linux64.tar.bz2 \ | |
&& echo "$PYPY_SHA256SUM /tmp/pypy.tar.bz2" | sha256sum -c \ | |
&& tar -xjC /usr/local --strip-components=1 -f /tmp/pypy.tar.bz2 | |
# install pip | |
RUN curl -L --output /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py \ | |
&& pypy3 /tmp/get-pip.py | |
# install Crossbar.io from PyPI | |
RUN pip install --no-cache-dir -U pip \ | |
&& pip install --no-cache-dir crossbar==${CROSSBAR_VERSION} | |
# get rid of generated bytecode | |
RUN find /usr/local -name "*.pyc" -delete | |
# | |
# Final image | |
# | |
FROM debian:jessie-slim | |
MAINTAINER The Crossbar.io Project <[email protected]> | |
# Metadata | |
ARG BUILD_DATE | |
ARG CROSSBAR_VCS_REF | |
ARG CROSSBAR_VERSION | |
# Metadata labeling | |
LABEL org.label-schema.build-date=$BUILD_DATE \ | |
org.label-schema.name="Crossbar.io Starter Template" \ | |
org.label-schema.description="Quickstart template for application development with Crossbar.io" \ | |
org.label-schema.url="http://crossbar.io" \ | |
org.label-schema.vcs-ref=$CROSSBAR_VCS_REF \ | |
org.label-schema.vcs-url="https://github.com/crossbario/crossbar" \ | |
org.label-schema.vendor="The Crossbar.io Project" \ | |
org.label-schema.version=$CROSSBAR_VERSION \ | |
org.label-schema.schema-version="1.0" | |
# Application home | |
ENV HOME /node | |
ENV DEBIAN_FRONTEND noninteractive | |
ENV PYTHONUNBUFFERED 1 | |
RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends \ | |
libexpat1 \ | |
libffi6 \ | |
libssl1.0.0 | |
# add our user and group | |
RUN adduser --system --group --uid 242 --home /node crossbar | |
# copy PyPy3 and all installed packages | |
COPY --from=0 /usr/local /usr/local/ | |
# test if everything installed properly | |
RUN crossbar version | |
# initialize a Crossbar.io node | |
COPY ./node/ /node/ | |
RUN chown -R crossbar:crossbar /node | |
# make /node a volume to allow external configuration | |
VOLUME /node | |
# set the Crossbar.io node directory as working directory | |
WORKDIR /node | |
# run under this user, and expose default port | |
USER crossbar | |
EXPOSE 8080 8000 | |
# entrypoint for the Docker image is the Crossbar.io executable | |
ENTRYPOINT ["crossbar", "start", "--cbdir", "/node/.crossbar"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment