Skip to content

Instantly share code, notes, and snippets.

@alexei-led
Created March 16, 2016 08:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexei-led/4f39cca8a03b1503978a to your computer and use it in GitHub Desktop.
Save alexei-led/4f39cca8a03b1503978a to your computer and use it in GitHub Desktop.
Dockerfile with ONTEST instruction
FROM "<base image>":"<version>"
WORKDIR "<path>"
# install packages required to run app
RUN apt-get update && apt-get install -y \
"<app runtime> and <dependencies>" \ # add app runtime and required packages
&& rm -rf /var/lib/apt/lists/*
# install packages required to run tests
ONTEST RUN apt-get update && apt-get install -y \
"<test tools> and <dependencies>" \ # add testing tools and required packages
&& rm -rf /var/lib/apt/lists/*
# copy app files
COPY app app
COPY run.sh run.sh
# copy test scripts
ONTEST COPY tests tests
# copy "main" test command
ONTEST COPY test.sh test.sh
# auto-generated volume for test results
# ONTEST VOLUME "/var/tests/results"
# ... EXPOSE, RUN, ADD ... for app and test environment
# main app command
CMD [run.sh, "<app arguments>"]
# main test command
ONTEST CMD [/test.sh, "<test arguments>"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment