mirror of
https://github.com/shiroyashik/sculptor.git
synced 2025-12-06 13:01:12 +03:00
Compare commits
No commits in common. "c4c622f018bd64ccf6693f92ac721ce5a53336eb" and "c0fc8ba2e853e2cd01a949492b97d10dc677d29a" have entirely different histories.
c4c622f018
...
c0fc8ba2e8
14 changed files with 1023 additions and 609 deletions
57
.github/actions/build/action.yml
vendored
57
.github/actions/build/action.yml
vendored
|
|
@ -1,57 +0,0 @@
|
|||
name: Build project
|
||||
description: Builds the project for specified targets using cargo-zigbuild.
|
||||
|
||||
inputs:
|
||||
targets:
|
||||
description: A comma-separated list of Rust targets.
|
||||
default: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,x86_64-pc-windows-gnu
|
||||
required: true
|
||||
lint:
|
||||
description: A boolean indicating if linting (cargo-fmt, clippy) should be run
|
||||
default: true
|
||||
required: true
|
||||
test:
|
||||
description: A boolean indicating if tests should be run
|
||||
default: true
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
|
||||
- name: Convert input targets to Bash array
|
||||
# read comma-separated list of targets, converts it to
|
||||
# an array of arguments for cargo-zigbuild like this:
|
||||
# [ "--target", "<target1>", "--target", "<target2>", ... ]
|
||||
shell: bash
|
||||
run: |
|
||||
targets=()
|
||||
while read -r target
|
||||
do targets+=("--target" "$target")
|
||||
done < <(tr , '\n' <<<"${{ inputs.targets }}")
|
||||
declare -p targets > /tmp/targets.sh
|
||||
|
||||
- name: Check with cargo-fmt
|
||||
if: inputs.lint == true
|
||||
shell: sh
|
||||
run: cargo fmt -v --all -- --check
|
||||
|
||||
- name: Run Clippy with cargo-zigbuild
|
||||
if: inputs.lint == true
|
||||
shell: bash
|
||||
run: |
|
||||
. /tmp/targets.sh
|
||||
cargo-zigbuild clippy -v --all-targets "${targets[@]}" -- -D warnings
|
||||
|
||||
- name: Build with cargo-zigbuild
|
||||
shell: bash
|
||||
run: |
|
||||
. /tmp/targets.sh
|
||||
cargo-zigbuild build -v -r --bin sculptor "${targets[@]}"
|
||||
|
||||
- name: Test with cargo-zigbuild
|
||||
shell: bash
|
||||
if: inputs.test == true
|
||||
run: |
|
||||
. /tmp/targets.sh
|
||||
cargo-zigbuild test -v -r "${targets[@]}"
|
||||
19
.github/actions/dependencies/action.yml
vendored
19
.github/actions/dependencies/action.yml
vendored
|
|
@ -1,19 +0,0 @@
|
|||
name: Install dependencies
|
||||
description: Installs Zig and cargo-zigbuild
|
||||
|
||||
inputs:
|
||||
zig-version:
|
||||
description: Version of Zig to install
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
|
||||
- name: Install Zig
|
||||
uses: mlugg/setup-zig@v2
|
||||
with:
|
||||
version: ${{ inputs.zig-version }}
|
||||
|
||||
- name: Install cargo-zigbuild
|
||||
shell: sh
|
||||
run: cargo install cargo-zigbuild
|
||||
12
.github/release-body.md
vendored
Normal file
12
.github/release-body.md
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
## Release (✧ω✧)
|
||||
|
||||
> [!CAUTION]
|
||||
> **Update your Config.toml according to the example in the repository!**
|
||||
|
||||
What's added:
|
||||
- Added support for **Assets**! As well as their automatic update from Figura repository!
|
||||
- WebSocket reworked! *No more panics!*
|
||||
- Reworked auto-update of conf files.
|
||||
- Fixed avatar size limits
|
||||
|
||||
**Full Changelog**: https://github.com/shiroyashik/sculptor/compare/v0.3.1...v0.4.0
|
||||
17
.github/release.yml
vendored
17
.github/release.yml
vendored
|
|
@ -1,17 +0,0 @@
|
|||
changelog:
|
||||
exclude:
|
||||
labels:
|
||||
- ignore-for-release
|
||||
categories:
|
||||
- title: Breaking Changes 🛠
|
||||
labels:
|
||||
- breaking-change
|
||||
- title: New Features 🎉
|
||||
labels:
|
||||
- enhancement
|
||||
- title: Bug fixes 🐛
|
||||
labels:
|
||||
- bug
|
||||
- title: Other Changes 🔄
|
||||
labels:
|
||||
- "*"
|
||||
63
.github/scripts/package-artifacts.sh
vendored
63
.github/scripts/package-artifacts.sh
vendored
|
|
@ -1,63 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
USAGE="\
|
||||
Usage: $0 [-t target]... [-o output_dir] [-h]
|
||||
-t target add a build target
|
||||
-o output_dir set output directory for compressed files (default: current directory)
|
||||
-h Show this help message and exit
|
||||
|
||||
Environment variables (override options):
|
||||
OUTPUT_DIR output directory for compressed files
|
||||
CARGO_BUILD_TARGETS comma-separated list of targets
|
||||
"
|
||||
targets=()
|
||||
output_dir=
|
||||
|
||||
while getopts "t:o:h" opt
|
||||
do
|
||||
case $opt in
|
||||
t) targets+=("$OPTARG") ;;
|
||||
o) output_dir="$OPTARG" ;;
|
||||
h) echo "$USAGE"; exit 0 ;;
|
||||
*) echo "Invalid option: ${opt}" >&2; echo "$USAGE"; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
output_dir="${OUTPUT_DIR:-${output_dir:-.}}"
|
||||
|
||||
if [ "${CARGO_BUILD_TARGETS+set}" ] # if set (might be empty)
|
||||
then IFS=',' read -ra targets <<< "$CARGO_BUILD_TARGETS"
|
||||
fi
|
||||
|
||||
compress-artifact() {
|
||||
local build_dir os arch binary_file common_files output_file
|
||||
|
||||
build_dir="$1"
|
||||
os="$2"
|
||||
arch="$3"
|
||||
|
||||
binary_file="${build_dir}/sculptor"
|
||||
# can be extended to include more files if needed
|
||||
common_files=("Config.example.toml")
|
||||
output_file="${output_dir}/sculptor-${os}-${arch}"
|
||||
|
||||
if [ "$2" = "windows" ]
|
||||
then zip -j "${output_file}.zip" "${binary_file}.exe" "${common_files[@]}"
|
||||
else tar --transform 's|^.*/||' -czf "${output_file}.tar.gz" "$binary_file" "${common_files[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
for target in "${targets[@]}"
|
||||
do
|
||||
build_dir="target/${target}/release"
|
||||
# add more targets as needed, for now only linux and windows
|
||||
if [[ "$target" =~ ^([^-]+)(-[^-]+)*-(linux|windows)(-[^-]+)*$ ]]
|
||||
then
|
||||
os="${BASH_REMATCH[3]}"
|
||||
arch="${BASH_REMATCH[1]}"
|
||||
compress-artifact "$build_dir" "$os" "$arch"
|
||||
else
|
||||
echo "ERROR: Invalid target: $target" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
79
.github/workflows/ci.yml
vendored
79
.github/workflows/ci.yml
vendored
|
|
@ -1,79 +0,0 @@
|
|||
name: Continuous Integration
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
paths:
|
||||
- src/**
|
||||
- Cargo*
|
||||
- Dockerfile
|
||||
# this file
|
||||
- .github/workflows/ci.yml
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
paths:
|
||||
- src/**
|
||||
- Cargo*
|
||||
- Dockerfile
|
||||
# this file
|
||||
- .github/workflows/ci.yml
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
ZIG_VERSION: 0.14.1
|
||||
CARGO_TERM_COLOR: always
|
||||
CARGO_BUILD_TARGETS: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,x86_64-pc-windows-gnu
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build, lint and test
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
OUTPUT_DIR: target/output
|
||||
# in case we wanted to test multiple toolchains:
|
||||
strategy:
|
||||
matrix:
|
||||
toolchain:
|
||||
- 1.87
|
||||
# - stable
|
||||
# - nightly
|
||||
steps:
|
||||
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use build cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
prefix-key: "cargo-v0"
|
||||
cache-all-crates: true
|
||||
|
||||
- name: Set up Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
targets: ${{ env.CARGO_BUILD_TARGETS }}
|
||||
components: clippy, rustfmt
|
||||
|
||||
- name: Install the build dependencies
|
||||
uses: ./.github/actions/dependencies
|
||||
with:
|
||||
zig-version: ${{ env.ZIG_VERSION }}
|
||||
|
||||
- name: Build the project
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
targets: ${{ env.CARGO_BUILD_TARGETS }}
|
||||
|
||||
- name: Create output directory for artifacts
|
||||
run: mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
- name: Package the artifacts
|
||||
run: ./.github/scripts/package-artifacts.sh
|
||||
|
||||
- name: Upload the artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: ${{ env.OUTPUT_DIR }}/*
|
||||
47
.github/workflows/dev-release.yml
vendored
Normal file
47
.github/workflows/dev-release.yml
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
name: Push Dev
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
tags-ignore:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# - name: Checkout code
|
||||
# uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# - name: Login to Docker Hub
|
||||
# uses: docker/login-action@v3
|
||||
# with:
|
||||
# username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||
# password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Get short SHA
|
||||
id: short_sha
|
||||
run: echo "sha=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
push: true
|
||||
# context: .
|
||||
platforms: |
|
||||
linux/amd64
|
||||
linux/arm64
|
||||
tags: ghcr.io/${{ github.repository_owner }}/sculptor:${{ steps.short_sha.outputs.sha }}
|
||||
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/sculptor:buildcache
|
||||
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/sculptor:buildcache,mode=max
|
||||
238
.github/workflows/release.yml
vendored
238
.github/workflows/release.yml
vendored
|
|
@ -1,151 +1,145 @@
|
|||
name: Release
|
||||
run-name: Release ${{ github.ref_name }}
|
||||
|
||||
# Stolen from https://github.com/mrjackwills/oxker :D
|
||||
name: Release CI
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
env:
|
||||
RUST_VERSION: 1.87
|
||||
ZIG_VERSION: 0.14.1
|
||||
ALPINE_VERSION: 3.22
|
||||
CARGO_TERM_COLOR: always
|
||||
CARGO_BUILD_TARGETS: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,x86_64-pc-windows-gnu
|
||||
- "v[0-9]+.[0-9]+.[0-9]+"
|
||||
|
||||
jobs:
|
||||
build-binary:
|
||||
name: Build binaries and upload them as artifacts
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
OUTPUT_DIR: target/output
|
||||
outputs:
|
||||
binary-artifact-id: ${{ steps.artifact-upload.outputs.artifact-id }}
|
||||
steps:
|
||||
#################################################
|
||||
## Cross platform binary build for release page #
|
||||
#################################################
|
||||
|
||||
- name: Checkout the code
|
||||
cross_platform_build:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- target: x86_64-unknown-linux-gnu
|
||||
output_name: linux_x86_64.tar.gz
|
||||
|
||||
- target: x86_64-pc-windows-gnu
|
||||
output_name: windows_x86_64.zip
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use build cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
prefix-key: "cargo-v0"
|
||||
cache-all-crates: true
|
||||
# Install stable rust, and associated tools
|
||||
- name: Install rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Set up Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{ env.RUST_VERSION }}
|
||||
targets: ${{ env.CARGO_BUILD_TARGETS }}
|
||||
# needed if we want to use linting in build action
|
||||
# components: clippy, rustfmt
|
||||
# Install cross-rs
|
||||
- name: Install cross
|
||||
run: cargo install cross --git https://github.com/cross-rs/cross
|
||||
|
||||
- name: Install the build dependencies
|
||||
uses: ./.github/actions/dependencies
|
||||
with:
|
||||
zig-version: ${{ env.ZIG_VERSION }}
|
||||
# Build binary
|
||||
- name: Build
|
||||
run: CROSS_NO_WARNINGS=0 cross build --target ${{ matrix.target }} --release
|
||||
|
||||
# Create necessary files and directories
|
||||
- name: Create necessary files
|
||||
run: |
|
||||
mkdir -p target/output
|
||||
cp Config.example.toml target/output/Config.toml
|
||||
|
||||
- name: Build the project
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
targets: ${{ env.CARGO_BUILD_TARGETS }}
|
||||
lint: false
|
||||
# Compress the output | Windows
|
||||
- name: Compress | windows
|
||||
if: matrix.target == 'x86_64-pc-windows-gnu'
|
||||
run: |
|
||||
cp target/${{ matrix.target }}/release/sculptor.exe target/output
|
||||
(cd target/output; zip "../../sculptor_${{ matrix.output_name }}" ./*)
|
||||
|
||||
- name: Create output directory for artifacts
|
||||
run: mkdir -p "$OUTPUT_DIR"
|
||||
# Compress the output | Linux
|
||||
- name: Compress | linux
|
||||
if: matrix.target != 'x86_64-pc-windows-gnu'
|
||||
run: |
|
||||
cp target/${{ matrix.target }}/release/sculptor target/output
|
||||
tar -czvf "./sculptor_${{ matrix.output_name }}" -C "target/output" .
|
||||
|
||||
- name: Package the artifacts
|
||||
run: ./.github/scripts/package-artifacts.sh
|
||||
|
||||
- name: Upload artifact
|
||||
id: artifact-upload
|
||||
# Upload output for release page
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: ${{ env.OUTPUT_DIR }}/*
|
||||
name: binaries-${{ github.ref_name }}
|
||||
if-no-files-found: error
|
||||
name: ${{ matrix.target }}
|
||||
path: sculptor_${{ matrix.output_name }}
|
||||
retention-days: 1
|
||||
|
||||
build-image:
|
||||
name: Build image and push to GHCR
|
||||
###################
|
||||
## Create release #
|
||||
###################
|
||||
|
||||
create_release:
|
||||
needs: [cross_platform_build]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout the code
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# if we wanted to push to DockerHub:
|
||||
- name: Setup | Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
- name: Update Release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
makeLatest: true
|
||||
name: ${{ github.ref_name }}
|
||||
tag: ${{ github.ref }}
|
||||
bodyFile: ".github/release-body.md"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
artifacts: |
|
||||
**/sculptor_*.zip
|
||||
**/sculptor_*.tar.gz
|
||||
##################
|
||||
## Cargo publish #
|
||||
##################
|
||||
|
||||
# cargo_publish:
|
||||
# needs: [create_release]
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Checkout
|
||||
# uses: actions/checkout@v4
|
||||
|
||||
# - name: publish to crates.io
|
||||
# uses: katyo/publish-crates@v2
|
||||
# with:
|
||||
# registry-token: ${{ secrets.CRATES_IO_TOKEN }}
|
||||
|
||||
#########################################
|
||||
## Build images for Dockerhub & ghcr.io #
|
||||
#########################################
|
||||
|
||||
image_build:
|
||||
needs: [create_release]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# - name: Login to DockerHub
|
||||
# uses: docker/login-action@v3
|
||||
# with:
|
||||
# username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
# password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
# also uncomment the tags parameter in the last step
|
||||
|
||||
# - name: Login to GitHub Container Registry
|
||||
# uses: docker/login-action@v3
|
||||
# with:
|
||||
# registry: ghcr.io
|
||||
# username: ${{ github.repository_owner }}
|
||||
# password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
id: buildx
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
build-args: |
|
||||
ALPINE_VERSION
|
||||
RUST_VERSION
|
||||
platforms: |
|
||||
linux/amd64
|
||||
linux/arm64
|
||||
# push: true
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository_owner }}/sculptor:latest
|
||||
ghcr.io/${{ github.repository_owner }}/sculptor:${{ github.ref_name }}
|
||||
# ${{ github.repository_owner }}/sculptor:latest
|
||||
# ${{ github.repository_owner }}/sculptor:${{ github.ref_name }}
|
||||
provenance: false
|
||||
sbom: false
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
create-release:
|
||||
name: Create GitHub release
|
||||
needs:
|
||||
- build-binary
|
||||
- build-image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-tags: true
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- name: Download the artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
artifact-ids: ${{ needs.build-binary.outputs.binary-artifact-id }}
|
||||
|
||||
- name: Create release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
install: true
|
||||
- name: Build for Dockerhub & ghcr.io
|
||||
run: |
|
||||
gh release create ${{ github.ref_name }} \
|
||||
--verify-tag \
|
||||
--generate-notes \
|
||||
--latest \
|
||||
--draft \
|
||||
binaries-${{ github.ref_name }}/*
|
||||
docker build --platform linux/amd64,linux/arm64 \
|
||||
-t ghcr.io/${{ github.repository_owner }}/sculptor:latest \
|
||||
-t ghcr.io/${{ github.repository_owner }}/sculptor:${{ github.ref_name }} \
|
||||
--provenance=false --sbom=false \
|
||||
--push \
|
||||
-f Dockerfile .
|
||||
24
.github/workflows/rust.yml
vendored
Normal file
24
.github/workflows/rust.yml
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
name: Rust
|
||||
|
||||
on: workflow_dispatch
|
||||
# push:
|
||||
# branches: [ "master" ]
|
||||
# pull_request:
|
||||
# branches: [ "master" ]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
|
||||
- name: Run tests
|
||||
run: cargo test --verbose
|
||||
1012
Cargo.lock
generated
1012
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
11
Cargo.toml
11
Cargo.toml
|
|
@ -25,7 +25,7 @@ dashmap = { version = "6.0", features = ["serde"] }
|
|||
faster-hex = "0.10"
|
||||
uuid = { version = "1.11", features = ["serde"] }
|
||||
base64 = "0.22"
|
||||
reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "rustls-tls"] }
|
||||
reqwest = { version = "0.12", features = ["blocking", "json"] }
|
||||
dotenvy = "0.15"
|
||||
semver = "1.0"
|
||||
walkdir = "2.5"
|
||||
|
|
@ -42,3 +42,12 @@ axum = { version = "0.8", features = ["ws", "macros", "http2"] }
|
|||
tower-http = { version = "0.6", features = ["trace"] }
|
||||
tokio = { version = "1.41", features = ["full"] }
|
||||
prometheus = { version = "0.14", features = ["process"] }
|
||||
|
||||
[dev-dependencies]
|
||||
cross = "0.2.5"
|
||||
|
||||
[workspace.metadata.cross.target.x86_64-unknown-linux-gnu]
|
||||
pre-build = [
|
||||
"dpkg --add-architecture $CROSS_DEB_ARCH",
|
||||
"apt-get update && apt-get --assume-yes install libssl-dev:$CROSS_DEB_ARCH"
|
||||
]
|
||||
|
|
|
|||
34
Dockerfile
34
Dockerfile
|
|
@ -1,11 +1,9 @@
|
|||
ARG ALPINE_VERSION=""
|
||||
ARG RUST_VERSION="1"
|
||||
## Chef
|
||||
# defaults to rust:1-alpine
|
||||
FROM --platform=$BUILDPLATFORM rust:${RUST_VERSION}-alpine${ALPINE_VERSION} AS chef
|
||||
# FROM clux/muslrust:stable AS chef
|
||||
FROM rust:1.87-alpine3.21 AS chef
|
||||
USER root
|
||||
RUN apk add --no-cache musl-dev cargo-zigbuild
|
||||
RUN cargo install --locked cargo-chef
|
||||
RUN apk add --no-cache musl-dev libressl-dev
|
||||
RUN cargo install cargo-chef
|
||||
WORKDIR /build
|
||||
|
||||
## Planner
|
||||
|
|
@ -17,33 +15,17 @@ RUN cargo chef prepare --recipe-path recipe.json
|
|||
## Builder
|
||||
FROM chef AS builder
|
||||
COPY --from=planner /build/recipe.json recipe.json
|
||||
# Map Docker's TARGETPLATFORM to Rust's build
|
||||
# target and save the result to a .env file
|
||||
ARG TARGETPLATFORM
|
||||
RUN <<EOT
|
||||
case "${TARGETPLATFORM}" in
|
||||
linux/amd64) export CARGO_BUILD_TARGET=x86_64-unknown-linux-musl ;;
|
||||
linux/arm64|linux/arm64/v8) export CARGO_BUILD_TARGET=aarch64-unknown-linux-musl ;;
|
||||
*) echo "Unsupported target platform: ${TARGETPLATFORM}" >&2; exit 1;;
|
||||
esac
|
||||
echo export CARGO_BUILD_TARGET="${CARGO_BUILD_TARGET}" > /tmp/builder.env
|
||||
rustup target add "${CARGO_BUILD_TARGET}"
|
||||
EOT
|
||||
# Build dependencies - this is the caching Docker layer!
|
||||
RUN . /tmp/builder.env && \
|
||||
cargo chef cook --recipe-path recipe.json --release --zigbuild
|
||||
RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json
|
||||
# Build application
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
COPY src src
|
||||
RUN . /tmp/builder.env && \
|
||||
cargo zigbuild -r --bin sculptor && \
|
||||
# Link the right output directory to a well known location for easier access when copying to the runtime image
|
||||
ln -s "$PWD/target/$CARGO_BUILD_TARGET/release" /tmp/build-output
|
||||
RUN cargo build --release --target x86_64-unknown-linux-musl --bin sculptor
|
||||
|
||||
## Runtime
|
||||
FROM alpine:${ALPINE_VERSION:-latest} AS runtime
|
||||
FROM alpine:3.21 AS runtime
|
||||
WORKDIR /app
|
||||
COPY --from=builder /tmp/build-output/sculptor /app/sculptor
|
||||
COPY --from=builder /build/target/x86_64-unknown-linux-musl/release/sculptor /app/sculptor
|
||||
|
||||
RUN apk add --no-cache tzdata
|
||||
ENV TZ=Etc/UTC
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
# The Sculptor
|
||||
|
||||
[](https://github.com/shiroyashik/sculptor/actions/workflows/ci.yml)
|
||||
[](https://github.com/shiroyashik/sculptor/actions/workflows/dev-release.yml)
|
||||
[](http://unmaintained.tech/)
|
||||
|
||||
Unofficial backend for the Minecraft mod [Figura](https://github.com/FiguraMC/Figura).
|
||||
|
||||
|
|
@ -25,6 +26,9 @@ To connect, simply change **Figura Cloud IP** in Figura settings to the address
|
|||
|
||||
Authentication is enabled on the server via: Mojang(Microsoft) and [Ely.By](https://ely.by/)
|
||||
|
||||
For reasons beyond my control, the server is not available in some countries.
|
||||
|
||||
|
||||
## Launch
|
||||
|
||||
To run it you will need a configured reverse proxy server.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
* Русский
|
||||
|
||||
# The Sculptor
|
||||
[](https://github.com/shiroyashik/sculptor/actions/workflows/ci.yml)
|
||||
[](https://github.com/shiroyashik/sculptor/actions/workflows/dev-release.yml)
|
||||
[](http://unmaintained.tech/)
|
||||
|
||||
Неофициальный бэкенд для Minecraft мода [Figura](https://github.com/FiguraMC/Figura).
|
||||
|
||||
|
|
@ -24,6 +25,8 @@
|
|||
|
||||
На сервере включена аутентификация через: Mojang(Microsoft) и [Ely.By](https://ely.by/)
|
||||
|
||||
По неконтролируемым мною причинам, сервер не доступен в некоторых странах.
|
||||
|
||||
## Запуск
|
||||
|
||||
Для его запуска вам понадобится настроенный обратный прокси-сервер.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue