diff --git a/.github/workflows/neard_linux_binary.yml b/.github/workflows/neard_linux_binary.yml index da1fcea72e5..e0461f7bc1e 100644 --- a/.github/workflows/neard_linux_binary.yml +++ b/.github/workflows/neard_linux_binary.yml @@ -1,4 +1,4 @@ -name: Neard Linux binary release +name: Neard Linux binary and Docker image release on: # Run when a new release or rc is created @@ -50,3 +50,26 @@ jobs: echo $(git rev-parse HEAD) > latest BRANCH=$(git branch --show-current) aws s3 cp --acl public-read latest s3://build.nearprotocol.com/nearcore/$(uname)/${BRANCH}/latest + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKER_PAT_TOKEN }} + + - name: Build and push Docker image to nearprotocol/nearcore + run: | + COMMIT=$(git rev-parse HEAD) + BRANCH=${{ github.ref_name }} + cp target/release/neard neard + docker build -t nearcore -f Dockerfile --progress=plain . + docker tag nearcore nearprotocol/nearcore:${BRANCH}-${COMMIT} + docker tag nearcore nearprotocol/nearcore:${BRANCH} + + docker push nearprotocol/nearcore:${BRANCH}-${COMMIT} + docker push nearprotocol/nearcore:${BRANCH} + if [[ ${BRANCH} == "master" ]]; + then + docker tag nearcore nearprotocol/nearcore:latest + docker push nearprotocol/nearcore:latest + fi \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 90ea4c23c5e..df9e342468a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,38 +1,5 @@ -# syntax=docker/dockerfile-upstream:experimental - -FROM ubuntu:18.04 as build - -RUN apt-get update -qq && apt-get install -y \ - git \ - cmake \ - g++ \ - pkg-config \ - libssl-dev \ - curl \ - llvm \ - clang \ - && rm -rf /var/lib/apt/lists/* - -COPY ./rust-toolchain.toml /tmp/rust-toolchain.toml - -ENV RUSTUP_HOME=/usr/local/rustup \ - CARGO_HOME=/usr/local/cargo \ - PATH=/usr/local/cargo/bin:$PATH - -RUN curl https://sh.rustup.rs -sSf | \ - sh -s -- -y --no-modify-path --default-toolchain none - -VOLUME [ /near ] -WORKDIR /near -COPY . . - -ENV PORTABLE=ON -ARG make_target= -RUN make CARGO_TARGET_DIR=/tmp/target \ - "${make_target:?make_target not set}" - -# Actual image -FROM ubuntu:18.04 +# Docker image +FROM ubuntu:22.04 EXPOSE 3030 24567 @@ -41,6 +8,6 @@ RUN apt-get update -qq && apt-get install -y \ && rm -rf /var/lib/apt/lists/* COPY scripts/run_docker.sh /usr/local/bin/run.sh -COPY --from=build /tmp/target/release/neard /usr/local/bin/ +COPY neard /usr/local/bin/ CMD ["/usr/local/bin/run.sh"]