Merge pull request #324 from napi-rs/new-docker-image
chore: build codes in node:10-alpine
This commit is contained in:
commit
007d1f61a5
3 changed files with 29 additions and 19 deletions
4
.github/workflows/docker.yaml
vendored
4
.github/workflows/docker.yaml
vendored
|
@ -22,8 +22,8 @@ jobs:
|
|||
|
||||
- name: Build docker image
|
||||
run: |
|
||||
docker build . -f alpine.Dockerfile --pull --no-cache -t docker.pkg.github.com/napi-rs/napi-rs/rust-nodejs-alpine:lts
|
||||
docker build . -f alpine.Dockerfile --pull --no-cache -t docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine
|
||||
|
||||
- name: Push docker image
|
||||
run: |
|
||||
docker push docker.pkg.github.com/napi-rs/napi-rs/rust-nodejs-alpine:lts
|
||||
docker push docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine
|
||||
|
|
28
.github/workflows/linux-musl.yaml
vendored
28
.github/workflows/linux-musl.yaml
vendored
|
@ -10,12 +10,24 @@ on:
|
|||
|
||||
jobs:
|
||||
build:
|
||||
name: stable - x86_64-unknown-linux-musl - node@14
|
||||
name: stable - x86_64-unknown-linux-musl - node@10
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Cache cargo registry
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cargo/registry
|
||||
key: stable-${{ matrix.os }}-node-alpine-@10-${{ matrix.node }}-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Cache cargo index
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cargo/git
|
||||
key: stable-${{ matrix.os }}-node-alpine-@10-${{ matrix.node }}-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Log in to registry
|
||||
run: |
|
||||
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
|
||||
|
@ -26,24 +38,24 @@ jobs:
|
|||
|
||||
- name: Pull docker image
|
||||
run: |
|
||||
docker pull docker.pkg.github.com/napi-rs/napi-rs/rust-nodejs-alpine:lts
|
||||
docker tag docker.pkg.github.com/napi-rs/napi-rs/rust-nodejs-alpine:lts builder
|
||||
docker pull docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine
|
||||
docker tag docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine builder
|
||||
|
||||
- name: 'Install node dependencies'
|
||||
run: docker run --rm -v $(pwd)/.cargo:/root/.cargo -v $(pwd):/napi-rs -w /napi-rs builder yarn
|
||||
run: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs builder yarn
|
||||
|
||||
- name: 'Install swc musl'
|
||||
run: docker run --rm -v $(pwd)/.cargo:/root/.cargo -v $(pwd):/napi-rs -w /napi-rs builder yarn add @swc/core-linux-musl --dev
|
||||
run: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs builder yarn add @swc/core-linux-musl --dev
|
||||
|
||||
- name: 'Build TypeScript'
|
||||
run: docker run --rm -v $(pwd)/.cargo:/root/.cargo -v $(pwd):/napi-rs -w /napi-rs builder yarn build
|
||||
run: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs builder yarn build
|
||||
|
||||
- name: Run check
|
||||
run: |
|
||||
docker run --rm -v $(pwd)/.cargo:/root/.cargo -v $(pwd):/napi-rs -w /napi-rs builder cargo check -vvv
|
||||
docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs builder cargo check -vvv
|
||||
|
||||
- name: Unit test
|
||||
run: |
|
||||
docker run --rm -v $(pwd)/.cargo:/root/.cargo -v $(pwd):/napi-rs -w /napi-rs builder sh -c "yarn build:test && yarn test"
|
||||
docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs builder sh -c "yarn build:test && yarn test"
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
FROM rust:alpine
|
||||
FROM node:10-alpine
|
||||
|
||||
ENV RUSTFLAGS="-C target-feature=-crt-static"
|
||||
ENV RUSTFLAGS="-C target-feature=-crt-static" \
|
||||
PATH="/root/.cargo/bin:$PATH" \
|
||||
CC="clang" \
|
||||
CXX="clang++"
|
||||
|
||||
RUN sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories && \
|
||||
apk update && \
|
||||
apk add nodejs yarn clang musl-dev llvm-dev curl && \
|
||||
export NODE_VERSION=$(node -e "console.log(process.version)") && \
|
||||
curl -fsSLO $(node -e "console.log(process.release.headersUrl)") && \
|
||||
tar -xf "node-$NODE_VERSION-headers.tar.gz" && \
|
||||
mv "node-$NODE_VERSION/include/node" include && \
|
||||
rm -rf "node-$NODE_VERSION" && \
|
||||
rm "node-$NODE_VERSION-headers.tar.gz"
|
||||
apk add rustup musl-dev build-base && \
|
||||
rustup-init -y
|
||||
|
|
Loading…
Reference in a new issue