From c7b6cb2fea39362ca3519dc8e440766b16eda8a4 Mon Sep 17 00:00:00 2001 From: John Cairns Date: Thu, 9 Nov 2023 12:20:43 -0600 Subject: [PATCH] 321: clean up +nightly in one more spot (#322) - use xmtp/rust container as prebuild --- .vscode/tasks.json | 20 ++++++++++-- Dockerfile | 79 +--------------------------------------------- 2 files changed, 19 insertions(+), 80 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 126d40da2..9897a7929 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -6,7 +6,7 @@ { "label": "fmt", "type": "shell", - "command": "cargo +nightly fmt --check", + "command": "cargo fmt --check", "options": { "cwd": "${workspaceFolder}" }, @@ -15,6 +15,19 @@ "isDefault": "false" } }, + { + "label": "lint", + "type": "shell", + "command": "cargo clippy --all-features --no-deps", + "options": { + "cwd": "${workspaceFolder}" + }, + "dependsOn": "fmt", + "group": { + "kind": "build", + "isDefault": "false" + } + }, { "label": "build", "type": "shell", @@ -22,6 +35,7 @@ "options": { "cwd": "${workspaceFolder}" }, + "dependsOn": "lint", "group": { "kind": "build", "isDefault": "false" @@ -34,6 +48,7 @@ "options": { "cwd": "${workspaceFolder}" }, + "dependsOn": "lint", "group": { "kind": "build", "isDefault": "true" @@ -46,10 +61,11 @@ "options": { "cwd": "${workspaceFolder}" }, + "dependsOn": "lint", "group": { "kind": "test", "isDefault": "true" } } ] -} \ No newline at end of file +} diff --git a/Dockerfile b/Dockerfile index c842a1929..c833bb4ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,80 +1,4 @@ -FROM debian:stable-slim as go-builder -# defined from build kit -# DOCKER_BUILDKIT=1 docker build . -t ... -ARG TARGETARCH - -FROM debian:stable-slim as builder -# defined from build kit -# DOCKER_BUILDKIT=1 docker build . -t ... -ARG TARGETARCH - -RUN export DEBIAN_FRONTEND=noninteractive && \ - apt update && \ - apt install -y -q --no-install-recommends \ - git curl gnupg2 build-essential \ - linux-headers-${TARGETARCH} libc6-dev \ - openssl libssl-dev pkg-config \ - ca-certificates apt-transport-https \ - python3 && \ - apt clean && \ - rm -rf /var/lib/apt/lists/* - -RUN useradd --create-home -s /bin/bash xmtp -RUN usermod -a -G sudo xmtp -RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers - -WORKDIR /rustup -## Rust -ADD https://sh.rustup.rs /rustup/rustup.sh -RUN chmod 755 /rustup/rustup.sh - -ENV USER=xmtp -USER xmtp -RUN /rustup/rustup.sh -y --default-toolchain stable --profile minimal - -ENV PATH=$PATH:~xmtp/.cargo/bin - -FROM debian:stable-slim -ARG TARGETARCH - -RUN export DEBIAN_FRONTEND=noninteractive && \ - apt update && \ - apt install -y -q --no-install-recommends \ - ca-certificates apt-transport-https \ - sudo ripgrep procps build-essential \ - python3 python3-pip python3-dev \ - git curl && \ - apt clean && \ - rm -rf /var/lib/apt/lists/* - -RUN echo "building platform $(uname -m)" - -RUN useradd --create-home -s /bin/bash xmtp -RUN usermod -a -G sudo xmtp -RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers - -## Node and NPM -RUN mkdir -p /usr/local/nvm -ENV NVM_DIR=/usr/local/nvm - -ENV NODE_VERSION=v20.9.0 - -ADD https://raw.githubusercontent.com/creationix/nvm/master/install.sh /usr/local/etc/nvm/install.sh -RUN bash /usr/local/etc/nvm/install.sh && \ - bash -c ". $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm alias default $NODE_VERSION && nvm use default" - -ENV NVM_NODE_PATH ${NVM_DIR}/versions/node/${NODE_VERSION} -ENV NODE_PATH ${NVM_NODE_PATH}/lib/node_modules -ENV PATH ${NVM_NODE_PATH}/bin:$PATH - -RUN npm install npm -g -RUN npm install yarn -g - - -## Rust from builder -COPY --chown=xmtp:xmtp --from=builder /home/xmtp/.cargo /home/xmtp/.cargo -COPY --chown=xmtp:xmtp --from=builder /home/xmtp/.rustup /home/xmtp/.rustup - +FROM ghcr.io/xmtp/rust:latest USER xmtp RUN ~xmtp/.cargo/bin/rustup toolchain install stable @@ -88,7 +12,6 @@ ENV PATH=~xmtp/.cargo/bin:$PATH ENV USER=xmtp RUN ~xmtp/.cargo/bin/cargo check -RUN ~xmtp/.cargo/bin/cargo --version RUN ~xmtp/.cargo/bin/cargo fmt --check RUN ~xmtp/.cargo/bin/cargo clippy --all-features --no-deps RUN ~xmtp/.cargo/bin/cargo clippy --all-features --no-deps --manifest-path xmtp/Cargo.toml