Skip to content

Commit

Permalink
Update dockerfile to include CCF build and source (#4702)
Browse files Browse the repository at this point in the history
  • Loading branch information
DomAyre authored Dec 8, 2022
1 parent 907d5c9 commit 10eee87
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
4 changes: 0 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
*
!getting_started
!docker

3 changes: 2 additions & 1 deletion .github/workflows/build-ci-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ jobs:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Log in
run: docker login -u $ACR_TOKEN_NAME -p ${{ secrets.ACR_CI_PUSH_TOKEN_PASSWORD }} $ACR_REGISTRY

- name: Build CCF CI SNP container
run: docker build -f docker/ccf_ci . --build-arg="platform=snp" -t $ACR_REGISTRY/ccf/ci:pr-${{ github.event.pull_request.head.sha }}
run: docker build -f docker/ccf_ci_built . --build-arg="platform=snp" -t $ACR_REGISTRY/ccf/ci:pr-${{ github.event.pull_request.head.sha }}

- name: Push CI container
run: docker push $ACR_REGISTRY/ccf/ci:pr-${{ github.event.pull_request.head.sha }}
1 change: 1 addition & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- `app_run`: Builds the image containing all runtime dependencies for CCF, as well as the latest release of CCF (as per https://github.com/microsoft/CCF/releases/latest). To be used by CCF operators.
- `app_dev`: Builds the image containing all build dependencies for CCF applications. To be used by CCF application developers.
- `ccf_ci`: Builds the image containing all build dependencies for CCF itself. To be used by CCF contributors. It is also used by CCF Continuous Integration pipeline.
- `ccf_ci_built`: Builds the image containing all build dependencies for CCF itself as well as CCF source and a build. To be used by CCF contributors. It is also used by CCF Continuous Integration pipeline.

To build a given image, run:

Expand Down
40 changes: 40 additions & 0 deletions docker/ccf_ci_built
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# CCF Continuous Integration image
# Contains CCF build dependencies and toolchain for target platform
# Also contains CCF source and build directory

ARG platform=sgx

# SGX
FROM ubuntu:20.04 AS base-sgx

WORKDIR /
COPY ./docker/sgx_deps_pin.sh /
RUN ./sgx_deps_pin.sh && rm ./sgx_deps_pin.sh

# SNP
FROM ubuntu:20.04 AS base-snp

# Virtual
FROM ubuntu:20.04 AS base-virtual

# Final CCF CI image
FROM base-${platform} AS final

ARG platform=sgx
ARG ansible_vars

RUN echo "APT::Acquire::Retries \"5\";" | tee /etc/apt/apt.conf.d/80-retries

COPY getting_started/setup_vm/ /tmp/setup_vm/
RUN apt update \
&& apt install -y ansible software-properties-common bsdmainutils dnsutils \
&& cd /tmp/setup_vm \
&& ansible-playbook ccf-dev.yml --extra-vars "$ansible_vars" --extra-vars "platform=${platform}" \
&& rm -rf /tmp/* \
&& apt remove -y ansible software-properties-common \
&& apt -y autoremove \
&& apt -y clean

RUN mkdir /CCF
COPY . /CCF/
RUN mkdir /CCF/build && cd /CCF/build && cmake -GNinja -DCOMPILE_TARGET=${platform} .. && ninja

0 comments on commit 10eee87

Please sign in to comment.