Skip to content

Commit

Permalink
Setup dockerfiles and update CI (#370)
Browse files Browse the repository at this point in the history
* Setup dockerfiles and update CI

* Update docker ignore files
  • Loading branch information
austinabell authored Apr 22, 2020
1 parent 68c4f9a commit c27deab
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*target**
.git
/test_dir*
23 changes: 6 additions & 17 deletions .github/workflows/ci-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,14 @@ jobs:
steps:
- uses: actions/checkout@v1

# TODO revisit this, workaround for now
- name: Install OpenCL
run: sudo apt install ocl-icd-opencl-dev
- name: Pull serialization vectors
run: git submodule update --init

- name: Toolchain setup
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build CI docker image
run: docker build -t forest/rust:latest -f ./Dockerfile-ci .

- name: Cargo test all
run: make test-all
- name: Test all
run: docker run forest/rust cargo test --all-features

fmt:
name: rustfmt
Expand Down Expand Up @@ -58,9 +53,6 @@ jobs:
steps:
- uses: actions/checkout@v1

- name: Install OpenCL
run: sudo apt install ocl-icd-opencl-dev

- name: Cache cargo registry
uses: actions/cache@v1
with:
Expand Down Expand Up @@ -109,9 +101,6 @@ jobs:
- name: Install Rust
run: rustup update beta && rustup default beta

- name: Install OpenCL
run: sudo apt install ocl-icd-opencl-dev

- name: Build documentation
run: cargo doc --no-deps --all-features
- name: Publish documentation
Expand Down
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This Dockerfile is for the main forest binary
# Example usage:
# docker build -t forest:latest -f ./Dockerfile .
# docker run forest

FROM rust:1.42-stretch AS build-env

WORKDIR /usr/src/forest
COPY . .

# Extra dependencies needed for rust-fil-proofs
RUN apt-get update && \
apt-get install -y curl file gcc g++ git make openssh-client \
autoconf automake cmake libtool libcurl4-openssl-dev libssl-dev \
libelf-dev libdw-dev binutils-dev zlib1g-dev libiberty-dev wget \
xz-utils pkg-config python clang ocl-icd-opencl-dev

RUN cargo install --path forest

# Prod image for forest binary
FROM debian:buster-slim

# Copy over binaries from the build-env
COPY --from=build-env /usr/local/cargo/bin/forest /usr/local/bin/forest

CMD ["forest"]
20 changes: 20 additions & 0 deletions Dockerfile-ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This Dockerfile is used for consistent build environment in CI
# Example usage:
# docker build -t forest/rust:latest -f ./Dockerfile-ci .
# docker run forest/rust cargo c

FROM rust:1.42-stretch

WORKDIR /usr/src/forest
COPY . .

# Extra dependencies needed for rust-fil-proofs
RUN apt-get update && \
apt-get install -y curl file gcc g++ git make openssh-client \
autoconf automake cmake libtool libcurl4-openssl-dev libssl-dev \
libelf-dev libdw-dev binutils-dev zlib1g-dev libiberty-dev wget \
xz-utils pkg-config python clang ocl-icd-opencl-dev

RUN bash -l -c 'echo $(rustc --print sysroot)/lib >> /etc/ld.so.conf'
RUN bash -l -c 'echo /usr/local/lib >> /etc/ld.so.conf'
RUN ldconfig
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
SER_TESTS = "tests/serialization_tests"

install:
cargo install --path forest --force

clean-all:
cargo clean

Expand Down Expand Up @@ -35,14 +38,11 @@ lint: license clean
cargo fmt --all
cargo clippy -- -D warnings

install:
cargo install --path forest --force

build:
cargo build
cargo build --bin forest

release:
cargo build --release
cargo build --release --bin forest

# Git submodule test vectors
pull-serialization-tests:
Expand Down
2 changes: 1 addition & 1 deletion scripts/add_license.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/bin/sh

PAT_APA="^// Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT$"

Expand Down

0 comments on commit c27deab

Please sign in to comment.