Skip to content

Commit

Permalink
Remove development things, imporve usability, improve README, add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
hacker-volodya committed Jun 11, 2024
1 parent 05f49bd commit 426958f
Show file tree
Hide file tree
Showing 13 changed files with 411 additions and 953 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Docker Image Publish

on:
push:
branches: [ "master" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "master" ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=${{ github.ref == 'refs/heads/master' }}
# Buildkit cache
# https://github.com/reproducible-containers/buildkit-cache-dance
- name: Cache
uses: actions/cache@v3
id: cache
with:
path: |
var-cache-buildkit
key: cache-${{ hashFiles('Dockerfile') }}

- name: Inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
with:
cache-map: |
{
"var-cache-buildkit": "/var/cache/buildkit"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: "{{defaultContext}}"
push: ${{ github.event_name != 'pull_request' }} # Don't push on PR
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
111 changes: 111 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ hex = "0.4"
x25519-dalek = { version = "2.0.1", features = ["static_secrets"] }
metrics = "0.22.3"
metrics-exporter-prometheus = { version = "0.14.0", default-features = false }
tokio-metrics-collector = { version = "0.2.1", features = ["rt"] }
tokio-metrics-collector = { version = "0.2.1", features = ["rt"] }
ureq = "2.9.7"
fs_extra = "1.3.0"
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ RUN --mount=type=cache,target=/var/cache/buildkit \
FROM debian:bookworm-slim AS runtime
WORKDIR /app
COPY --from=builder /ton-node /usr/local/bin
COPY config /config
EXPOSE 3000
ENTRYPOINT ["/usr/local/bin/ton-node"]
VOLUME /data
ENTRYPOINT ["/usr/local/bin/ton-node"]

# http
EXPOSE 3000/tcp

# liteapi
EXPOSE 3333/tcp

# nodes p2p
EXPOSE 30303/udp
Loading

0 comments on commit 426958f

Please sign in to comment.