diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..612548ba7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +.git/ +CHANGELOG.md +clippy.toml +deny.toml +docs/ +gitlint +libstd/build/ +macstadium.png +scripts/ +target/ +tmp/ diff --git a/Dockerfile b/Dockerfile index 3e3892ba3..fd5ea68b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,16 @@ FROM alpine:3 AS builder RUN apk add --update make libffi libffi-dev rust cargo build-base - -# Per https://github.com/containers/buildah/issues/1849#issuecomment-635579332, -# the presence of a .dockerignore slows down the build process. To work around -# this, we add the necessary files/directories explicitly, instead of using -# `ADD . /inko/` to add files. -ADD Cargo.lock Cargo.toml LICENSE Makefile /inko/ -ADD .cargo /inko/.cargo/ -ADD ast /inko/ast/ -ADD bytecode /inko/bytecode/ -ADD compiler /inko/compiler/ -ADD libstd/src /inko/compiler/libstd/src -ADD vm /inko/vm - +ADD . /inko/ WORKDIR /inko -RUN make build FEATURES='libffi-system' PREFIX='/usr' +RUN make build FEATURES=libffi-system PREFIX='/usr' RUN strip target/release/inko RUN make install PREFIX='/usr' FROM alpine:3 # libgcc is needed because libgcc is dynamically linked to the executable. -RUN apk add --update libffi libffi-dev ruby ruby-json libgcc +RUN apk add --update libffi libffi-dev libgcc COPY --from=builder ["/usr/bin/inko", "/usr/bin/inko"] COPY --from=builder ["/usr/lib/inko", "/usr/lib/inko/"] diff --git a/Makefile b/Makefile index 50a9c0a6c..9df85d1ac 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,7 @@ SOURCE_TAR := ${TMP_DIR}/${VERSION}.tar.gz MANIFEST := ${TMP_DIR}/manifest.txt build: - INKO_LIBSTD=${INSTALL_STD} cargo build --release + INKO_LIBSTD=${INSTALL_STD} cargo build --release ${FEATURES_OPTION} ${TMP_DIR}: mkdir -p "${@}" @@ -161,7 +161,7 @@ docs/versions: clippy: touch */src/lib.rs */src/main.rs - cargo clippy ${FEATURES_OPTION} -- -D warnings + cargo clippy -- -D warnings rustfmt-check: rustfmt --check */src/lib.rs */src/main.rs diff --git a/docs/source/getting-started/installation.md b/docs/source/getting-started/installation.md index 238f1dc82..e03277aae 100644 --- a/docs/source/getting-started/installation.md +++ b/docs/source/getting-started/installation.md @@ -179,6 +179,12 @@ variable. When packaging Inko it's best to use a system wide installation of FFI, instead of building it from source when compiling Inko. To do so, build Inko as follows: +```bash +make build FEATURES=libffi-system +``` + +Or if you don't want to use make: + ```bash cargo build --release --features libffi-system ```