Skip to content

Commit

Permalink
Docker push GHA workflow (#10171)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-near authored Nov 15, 2023
1 parent e85fca3 commit 7e93c6e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 37 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/neard_linux_binary.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
39 changes: 3 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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"]

0 comments on commit 7e93c6e

Please sign in to comment.