Skip to content

Instantly share code, notes, and snippets.

@vsoch
Last active May 1, 2019 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vsoch/1235f639d50d358a017abce651580435 to your computer and use it in GitHub Desktop.
Save vsoch/1235f639d50d358a017abce651580435 to your computer and use it in GitHub Desktop.
An example of how to put a really long error log (or similar) in markdown! It's all about details. :)

Lots of discussion, blardee boo, and here is my Dockerfile that is important to you!

FROM debian:stretch-backports

LABEL authors="@bnmnetp,@vsoch,@yarikoptic"

# docker build -t runstone/server .

# Define some ARGs which could be passed into while building
ARG WEB2PY_PATH=/srv/web2py
ARG WEB2PY_APPS_PATH=${WEB2PY_PATH}/applications
ARG WEB2PY_PORT=8080

# And export some as env vars so they could be available at run time
ENV WEB2PY_PATH=${WEB2PY_PATH}
ENV RUNESTONE_PATH=${WEB2PY_APPS_PATH}/runestone
ENV BOOKS_PATH=${RUNESTONE_PATH}/books
ENV WEB2PY_VERSION=2.18.4
ENV DBHOST=db

# Expose that port on the network
EXPOSE ${WEB2PY_PORT}

# To prevent interactive debconf during installations
ARG DEBIAN_FRONTEND=noninteractive

# Components from requirements.txt which are available in Debian
RUN apt-get update && \
    apt-get install -y eatmydata && \
    eatmydata apt-get update && echo "count 1" && \
    eatmydata apt-get install -y --no-install-recommends \
        gcc \
        git \
        unzip \
        python-pip libfreetype6-dev postgresql-common postgresql postgresql-contrib \
        libpq-dev libxml2-dev libxslt1-dev \
        python-setuptools \
        python-numpy \
        python-dev \
        python-wheel rsync wget nginx && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*


# The rest could be done and ran under a regular (well, staff for installing under /usr/local) user
RUN useradd -s /bin/bash -M -g staff --home-dir ${WEB2PY_PATH} runestone && \
    mkdir -p /srv

# Install additional components
RUN git clone https://github.com/web2py/web2py ${WEB2PY_PATH} && \
    cd ${WEB2PY_PATH} && \
    git submodule update --init --recursive

RUN mkdir -p ${RUNESTONE_PATH}
ADD . ${RUNESTONE_PATH}
WORKDIR ${RUNESTONE_PATH}

# Question: should this come from an envar?
# Set docker_institution_mode = True so that instructors can use thinkcspy and other
# base courses as their course when using docker to host their own courses.
RUN mkdir -p private && \
    echo "sha512:16492eda-ba33-48d4-8748-98d9bbdf8d33" > private/auth.key && \
    pip install --system -r requirements.txt && \
    pip install --system -r requirements-test.txt && \
    rm -rf ${WEB2PY_PATH}/.cache/* && \
    cp ${RUNESTONE_PATH}/scripts/run_scheduler.py ${WEB2PY_PATH}/run_scheduler.py && \
    cp ${RUNESTONE_PATH}/scripts/routes.py ${WEB2PY_PATH}/routes.py

WORKDIR ${WEB2PY_PATH}

# All configuration will be done within entrypoint.sh upon initial run
# of the container
COPY docker/entrypoint.sh /usr/local/sbin/entrypoint.sh

#RUN chown -R runestone /srv
CMD /bin/bash /usr/local/sbin/entrypoint.sh

And I can change the Title too with <summary></summary>

Dockerfile
FROM debian:stretch-backports

LABEL authors="@bnmnetp,@vsoch,@yarikoptic"

# docker build -t runstone/server .

# Define some ARGs which could be passed into while building
ARG WEB2PY_PATH=/srv/web2py
ARG WEB2PY_APPS_PATH=${WEB2PY_PATH}/applications
ARG WEB2PY_PORT=8080

# And export some as env vars so they could be available at run time
ENV WEB2PY_PATH=${WEB2PY_PATH}
ENV RUNESTONE_PATH=${WEB2PY_APPS_PATH}/runestone
ENV BOOKS_PATH=${RUNESTONE_PATH}/books
ENV WEB2PY_VERSION=2.18.4
ENV DBHOST=db

# Expose that port on the network
EXPOSE ${WEB2PY_PORT}

# To prevent interactive debconf during installations
ARG DEBIAN_FRONTEND=noninteractive

# Components from requirements.txt which are available in Debian
RUN apt-get update && \
    apt-get install -y eatmydata && \
    eatmydata apt-get update && echo "count 1" && \
    eatmydata apt-get install -y --no-install-recommends \
        gcc \
        git \
        unzip \
        python-pip libfreetype6-dev postgresql-common postgresql postgresql-contrib \
        libpq-dev libxml2-dev libxslt1-dev \
        python-setuptools \
        python-numpy \
        python-dev \
        python-wheel rsync wget nginx && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*


# The rest could be done and ran under a regular (well, staff for installing under /usr/local) user
RUN useradd -s /bin/bash -M -g staff --home-dir ${WEB2PY_PATH} runestone && \
    mkdir -p /srv

# Install additional components
RUN git clone https://github.com/web2py/web2py ${WEB2PY_PATH} && \
    cd ${WEB2PY_PATH} && \
    git submodule update --init --recursive

RUN mkdir -p ${RUNESTONE_PATH}
ADD . ${RUNESTONE_PATH}
WORKDIR ${RUNESTONE_PATH}

# Question: should this come from an envar?
# Set docker_institution_mode = True so that instructors can use thinkcspy and other
# base courses as their course when using docker to host their own courses.
RUN mkdir -p private && \
    echo "sha512:16492eda-ba33-48d4-8748-98d9bbdf8d33" > private/auth.key && \
    pip install --system -r requirements.txt && \
    pip install --system -r requirements-test.txt && \
    rm -rf ${WEB2PY_PATH}/.cache/* && \
    cp ${RUNESTONE_PATH}/scripts/run_scheduler.py ${WEB2PY_PATH}/run_scheduler.py && \
    cp ${RUNESTONE_PATH}/scripts/routes.py ${WEB2PY_PATH}/routes.py

WORKDIR ${WEB2PY_PATH}

# All configuration will be done within entrypoint.sh upon initial run
# of the container
COPY docker/entrypoint.sh /usr/local/sbin/entrypoint.sh

#RUN chown -R runestone /srv
CMD /bin/bash /usr/local/sbin/entrypoint.sh

Take a look at the source to see how this is done! It's basically a <details></details> section wrapping a shell code one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment