Skip to content

Commit

Permalink
Merge pull request #480 from CosmWasm/no-go-in-builder
Browse files Browse the repository at this point in the history
Remove Go dev environment from Alpine builder
  • Loading branch information
webmaster128 authored Nov 29, 2023
2 parents 2b87548 + 5059f30 commit 3f35900
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 30 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ workflows:
only:
# long living branches
- main
- 0.14-dev
# Development
- no-go-in-builder
# Run only on main, not on tags (auto-build on merge PR)
- deploy_to_git:
requires:
Expand Down
7 changes: 7 additions & 0 deletions Dockerfile.alpine_tester
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM golang:1.21.4-alpine

RUN apk add build-base

# prepare go cache dirs
RUN mkdir -p /.cache/go-build
RUN chmod -R 777 /.cache
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

# Builds the Rust library libwasmvm
BUILDERS_PREFIX := cosmwasm/go-ext-builder:0017
# Contains a full Go dev environment in order to run Go tests on the built library
ALPINE_TESTER := cosmwasm/go-ext-builder:0017-alpine
# Contains a full Go dev environment including CGO support in order to run Go tests on the built shared library
# This image is currently not published.
ALPINE_TESTER := cosmwasm/alpine-tester:local

USER_ID := $(shell id -u)
USER_GROUP = $(shell id -g)
Expand Down Expand Up @@ -123,7 +124,12 @@ release-build:
make release-build-macos
make release-build-windows

test-alpine: release-build-alpine
.PHONY: create-tester-image
create-tester-image:
docker build -t $(ALPINE_TESTER) - < ./Dockerfile.alpine_tester

test-alpine: release-build-alpine create-tester-image
@[ "$(shell uname -m)" = "x86_64" ] || (echo "This test is only working on x86_64. See https://github.com/CosmWasm/wasmvm/issues/483."; exit 78)
# try running go tests using this lib with muslc
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/mnt/testrun -w /mnt/testrun $(ALPINE_TESTER) go build -tags muslc ./...
# Use package list mode to include all subdirectores. The -count=1 turns off caching.
Expand Down
28 changes: 2 additions & 26 deletions builders/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
# This image is used for two things (which is not ideal, but yeah):
# 1. Build the static Rust library
# 2. Execute Go tests that use and test this library
# For 2. we define the Go image here. For 1. we install Rust below.
#
# See also docs/COMPILER_VERSIONS.md
FROM golang:1.20.10-alpine

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
FROM rust:1.73.0-alpine

# this comes from standard alpine nightly file
# https://github.com/rust-lang/docker-rust-nightly/blob/master/alpine3.12/Dockerfile
# with some changes to support our toolchain, etc
RUN set -eux \
&& apk add --no-cache ca-certificates build-base

RUN wget "https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-musl/rustup-init" \
&& chmod +x rustup-init \
&& ./rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.73.0 \
&& rm rustup-init \
&& chmod -R a+w $RUSTUP_HOME $CARGO_HOME
RUN apk add --no-cache ca-certificates build-base

# Install C compiler for cross-compilation. This is required by
# Wasmer in https://github.com/wasmerio/wasmer/blob/2.2.1/lib/vm/build.rs.
Expand All @@ -34,10 +14,6 @@ RUN wget https://musl.cc/aarch64-linux-musl-cross.tgz \
&& /opt/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc --version \
&& rm aarch64-linux-musl-cross.tgz

# prepare go cache dirs
RUN mkdir -p /.cache/go-build
RUN chmod -R 777 /.cache

# allow non-root user to download more deps later
RUN chmod -R 777 /usr/local/cargo

Expand Down
4 changes: 4 additions & 0 deletions builders/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ versions of the builder images.

## Changelog

**Unreleased**

- Remove Go dev environment from `cosmwasm/go-ext-builder:XXXX-alpine`

**Version 0017:**

- Update Rust to 1.73.0.
Expand Down

0 comments on commit 3f35900

Please sign in to comment.