Skip to content

Commit

Permalink
Make the Docker image smaller and build faster (rigetti#1039)
Browse files Browse the repository at this point in the history
* Use the 1.12.1 version of the quilc image

* Only copy over binaries and shared libraries from quilc / qvm

* No longer use the Debian testing apt repos

* Add a pre-release safeguard that tests the Docker image

* Add a .dockerignore file that removes unnecessary files

* Update the changelog accordingly
  • Loading branch information
karalekas authored Oct 9, 2019
1 parent 7815879 commit e023121
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
14 changes: 14 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.coveragerc
.git
.gitlab-ci.yml
.gitignore
.github
docs
ACKNOWLEDGEMENTS.md
CHANGELOG.md
CONTRIBUTING.md
Makefile
MANIFEST.in
NOTICE.md
readthedocs.yml
tox.ini
12 changes: 12 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,15 @@ docs:
- apt-get update && apt-get install -y pandoc
- pandoc --from=markdown --to=rst --output=docs/source/changes.rst CHANGELOG.md
- tox -e docs

test-docker:
stage: test
image: docker:stable
tags:
- dockerd
- github
only:
refs:
- /^v(\d+\.)?(\d+\.)?(\d+)$/
script:
- docker run --rm $IMAGE:edge python -c "from pyquil import get_qc; qvm = get_qc('9q-qvm')"
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Changelog
to quickly get started with compiling and simulating quantum programs! When
running the image, a user will be dropped into an `ipython` REPL that has
pyQuil and its requirements preinstalled, along with quilc and qvm servers
running in the background (@karalekas, gh-1035).
running in the background (@karalekas, gh-1035, gh-1039).

### Improvements and Changes

Expand Down
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# specify the dependency versions (can be overriden with --build-arg)
ARG quilc_version=1.12.0
ARG quilc_version=1.12.1
ARG qvm_version=1.12.0
ARG python_version=3.6

Expand All @@ -8,15 +8,15 @@ FROM rigetti/quilc:$quilc_version as quilc
FROM rigetti/qvm:$qvm_version as qvm
FROM python:$python_version

# copy over the pre-built quilc binary from the first build stage
COPY --from=quilc /src/quilc /src/quilc
# copy over the pre-built quilc binary and tweedledum library from the first build stage
COPY --from=quilc /usr/local/lib/libtweedledum.so /usr/local/lib/libtweedledum.so
COPY --from=quilc /src/quilc/quilc /src/quilc/quilc

# copy over the pre-built qvm binary from the second build stage
COPY --from=qvm /src/qvm /src/qvm
COPY --from=qvm /src/qvm/qvm /src/qvm/qvm

# install the missing apt requirements that can't be copied over
RUN echo "deb http://http.us.debian.org/debian/ testing non-free contrib main" >> /etc/apt/sources.list && \
apt-get update && apt-get -yq dist-upgrade && \
# install the missing apt that aren't copied over
RUN apt-get update && apt-get -yq dist-upgrade && \
apt-get install --no-install-recommends -yq \
clang-7 git libblas-dev libffi-dev liblapack-dev libzmq3-dev && \
rm -rf /var/lib/apt/lists/*
Expand Down

0 comments on commit e023121

Please sign in to comment.