Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logic for handling git dependencies #82

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ RUN cd build_workspace && \
#
FROM rust:1.60.0-alpine as base-optimizer

# Being required for gcc linking
# musl-dev is required for gcc linking.
# Adding Git for usage within projects that use `git-fetch-with-cli = true`.
RUN apk update && \
apk add --no-cache musl-dev
apk add --no-cache musl-dev git

# Setup Rust with Wasm support
RUN rustup target add wasm32-unknown-unknown
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@ docker run --rm -v "$(pwd)":/code \
Demo this with `cosmwasm-examples` (going into eg. `erc20` subdir before running),
with `cosmwasm-plus`, or with a sample app from `cosmwasm-template`.

### Configuring Private Repo Dependencies

SSH credentials for fetching private repo dependencies can be configured through environment variable `GIT_CREDENTIALS`

```sh
docker run -e GIT_CREDENTIALS=https://<gituser>:<token>@github.com --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.6
```
adityakalia marked this conversation as resolved.
Show resolved Hide resolved


**Note**: *This makes reproducible builds somewhere between hard and impossible.*


## Caching

Note that we use one registry cache (to avoid excessive downloads), but the target cache is a different volume per
adityakalia marked this conversation as resolved.
Show resolved Hide resolved
contract that we compile. This means no interference between contracts, but very fast recompile times when making
minor adjustments to a contract you had previously created an optimized build for.
Expand Down
1 change: 1 addition & 0 deletions optimize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
set -o errexit -o nounset -o pipefail
command -v shellcheck >/dev/null && shellcheck "$0"

[ -n "${GIT_CREDENTIALS=""}" ] && echo "$GIT_CREDENTIALS" >~/.git-credentials && git config --global credential.helper store
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[ -n "${GIT_CREDENTIALS=""}" ] && echo "$GIT_CREDENTIALS" >~/.git-credentials && git config --global credential.helper store
[ -n "${GIT_CREDENTIALS:=""}" ] && echo "$GIT_CREDENTIALS" >~/.git-credentials && git config --global credential.helper store

export PATH=$PATH:/root/.cargo/bin

# Suffix for non-Intel built artifacts
Expand Down
1 change: 1 addition & 0 deletions optimize_workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
set -o errexit -o nounset -o pipefail
command -v shellcheck >/dev/null && shellcheck "$0"

[ -n "${GIT_CREDENTIALS:=""}" ] && echo "$GIT_CREDENTIALS" >~/.git-credentials && git config --global credential.helper store
export PATH="$PATH:/root/.cargo/bin"

# Suffix for non-Intel built artifacts
Expand Down