From 0a9d741e93bedc9814c26be9e95f13f2f17d163d Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 19 Mar 2021 11:53:48 +0800 Subject: [PATCH] ci: use lts alpine image --- .github/workflows/docker.yaml | 6 +++--- .github/workflows/linux-musl.yaml | 19 +++++++------------ alpine.Dockerfile | 2 +- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 647e68df..eac6211a 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -6,7 +6,7 @@ on: jobs: build_image: - name: Build rust-nodejs-alpine:lts + name: Build nodejs-rust:lts-alpine runs-on: ubuntu-latest steps: @@ -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/nodejs-rust:10-alpine + docker build . -f alpine.Dockerfile --pull --no-cache -t docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:lts-alpine - name: Push docker image run: | - docker push docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine + docker push docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:lts-alpine diff --git a/.github/workflows/linux-musl.yaml b/.github/workflows/linux-musl.yaml index be6e0841..774f83ca 100644 --- a/.github/workflows/linux-musl.yaml +++ b/.github/workflows/linux-musl.yaml @@ -11,7 +11,7 @@ on: jobs: build: - name: stable - x86_64-unknown-linux-musl - node@10 + name: stable - x86_64-unknown-linux-musl - node@lts runs-on: ubuntu-latest steps: @@ -21,27 +21,24 @@ jobs: uses: actions/cache@v1 with: path: ~/.cargo/registry - key: stable-alpine-node-alpine-@10-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }} + key: stable-alpine-node-alpine-@lts-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }} - name: Cache cargo index uses: actions/cache@v1 with: path: ~/.cargo/git - key: stable-alpine-node-alpine-@10-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }} + key: stable-alpine-node-alpine-@lts-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }} - - name: Log in to registry + - name: Pull docker image run: | docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL + docker pull docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:lts-alpine + docker tag docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:lts-alpine builder env: DOCKER_REGISTRY_URL: docker.pkg.github.com DOCKER_USERNAME: ${{ github.actor }} DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - - name: Pull docker image - run: | - 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 ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs builder yarn @@ -54,6 +51,4 @@ jobs: - name: Unit test run: | - 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 + docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs -e RUST_BACKTRACE=1 builder sh -c "yarn build:test && yarn test" diff --git a/alpine.Dockerfile b/alpine.Dockerfile index d0862b4d..0461b3df 100644 --- a/alpine.Dockerfile +++ b/alpine.Dockerfile @@ -1,4 +1,4 @@ -FROM node:10-alpine +FROM node:lts-alpine ENV RUSTFLAGS="-C target-feature=-crt-static" \ PATH="/usr/local/cargo/bin/rustup:/root/.cargo/bin:$PATH" \