mirror of
https://github.com/SinTan1729/chhoto-url
synced 2024-12-28 08:28:36 -06:00
Compare commits
No commits in common. "731cb416466d084d915d1afcebd0738f71763977" and "dfefff2703074fc8e76c90f710be0d28b56f0295" have entirely different histories.
731cb41646
...
dfefff2703
3 changed files with 22 additions and 30 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,5 +1,6 @@
|
||||||
# Ignore build outputs
|
# Ignore build outputs
|
||||||
actix/target
|
actix/target
|
||||||
|
.docker
|
||||||
|
|
||||||
# Ignore SQLite file
|
# Ignore SQLite file
|
||||||
urls.sqlite
|
urls.sqlite
|
||||||
|
@ -7,5 +8,3 @@ urls.sqlite
|
||||||
# Ignore irrelevant dotfiles
|
# Ignore irrelevant dotfiles
|
||||||
.vscode/
|
.vscode/
|
||||||
**/.directory
|
**/.directory
|
||||||
.env
|
|
||||||
|
|
||||||
|
|
33
Makefile
33
Makefile
|
@ -1,42 +1,19 @@
|
||||||
# .env file has the variables $DOCKER_USERNAME and $PASSWORD defined
|
USERNAME := ${DOCKER_USERNAME}
|
||||||
include .env
|
|
||||||
|
|
||||||
setup:
|
setup:
|
||||||
cargo install cross
|
cargo install cross
|
||||||
rustup target add x86_64-unknown-linux-musl
|
|
||||||
docker buildx create --use --platform=linux/arm64,linux/amd64 --name multi-platform-builder
|
docker buildx create --use --platform=linux/arm64,linux/amd64 --name multi-platform-builder
|
||||||
docker buildx inspect --bootstrap
|
docker buildx inspect --bootstrap
|
||||||
|
|
||||||
build-dev:
|
build:
|
||||||
cargo build --release --locked --manifest-path=actix/Cargo.toml --target x86_64-unknown-linux-musl
|
|
||||||
|
|
||||||
docker-local: build-dev
|
|
||||||
docker build --tag chhoto-url --build-arg TARGETARCH=amd64 -f Dockerfile.multiarch .
|
|
||||||
|
|
||||||
docker-test: docker-local
|
|
||||||
docker ps -q --filter "name=chhoto-url" | xargs -r docker stop
|
|
||||||
docker ps -aq --filter "name=chhoto-url" | xargs -r docker rm
|
|
||||||
docker run -p 4567:4567 --name chhoto-url -e password="${PASSWORD}" -d chhoto-url
|
|
||||||
docker logs chhoto-url -f
|
|
||||||
|
|
||||||
docker-dev: build-dev
|
|
||||||
docker build --push --tag ${DOCKER_USERNAME}/chhoto-url:dev --build-arg TARGETARCH=amd64 -f Dockerfile.multiarch .
|
|
||||||
|
|
||||||
build-release:
|
|
||||||
cross build --release --locked --manifest-path=actix/Cargo.toml --target aarch64-unknown-linux-musl
|
cross build --release --locked --manifest-path=actix/Cargo.toml --target aarch64-unknown-linux-musl
|
||||||
cross build --release --locked --manifest-path=actix/Cargo.toml --target armv7-unknown-linux-musleabihf
|
cross build --release --locked --manifest-path=actix/Cargo.toml --target armv7-unknown-linux-musleabihf
|
||||||
cross build --release --locked --manifest-path=actix/Cargo.toml --target x86_64-unknown-linux-musl
|
cross build --release --locked --manifest-path=actix/Cargo.toml --target x86_64-unknown-linux-musl
|
||||||
|
|
||||||
V_PATCH := $(shell cat actix/Cargo.toml | sed -rn 's/^version = "(.+)"$$/\1/p')
|
docker: build
|
||||||
V_MINOR := $(shell cat actix/Cargo.toml | sed -rn 's/^version = "(.+)\..+"$$/\1/p')
|
docker buildx build --push --tag ${USERNAME}/chhoto-url:dev --platform linux/amd64,linux/arm64,linux/arm/v7 -f Dockerfile.multiarch .
|
||||||
V_MAJOR := $(shell cat actix/Cargo.toml | sed -rn 's/^version = "(.+)\..+\..+"$$/\1/p')
|
|
||||||
docker-release: build-release
|
|
||||||
docker buildx build --push --tag ${DOCKER_USERNAME}/chhoto-url:${V_MAJOR} --tag ${DOCKER_USERNAME}/chhoto-url:${V_MINOR} --tag ${DOCKER_USERNAME}/chhoto-url:${V_PATCH} \
|
|
||||||
---tag ${DOCKER_USERNAME}/chhoto-url:latest -platform linux/amd64,linux/arm64,linux/arm/v7 -f Dockerfile.multiarch .
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
docker ps -q --filter "name=chhoto-url" | xargs -r docker stop
|
|
||||||
docker ps -aq --filter "name=chhoto-url" | xargs -r docker rm
|
|
||||||
cargo clean --manifest-path=actix/Cargo.toml
|
cargo clean --manifest-path=actix/Cargo.toml
|
||||||
|
|
||||||
.PHONY: build-dev docker-local build-release
|
.PHONY: build
|
||||||
|
|
16
docker_push_script.sh
Executable file
16
docker_push_script.sh
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/env bash
|
||||||
|
|
||||||
|
if [ "$1" == "dev" ]; then
|
||||||
|
docker buildx build --push --tag sintan1729/$name:dev .
|
||||||
|
|
||||||
|
elif [ "$1" == "release" ]; then
|
||||||
|
v_patch=$(cat actix/Cargo.toml | sed -rn 's/^version = "(.+)"$/\1/p')
|
||||||
|
v_minor=$(echo $v_patch | sed -rn 's/^(.+\..+)\..+$/\1/p')
|
||||||
|
v_major=$(echo $v_minor | sed -rn 's/^(.+)\..+$/\1/p')
|
||||||
|
|
||||||
|
make build
|
||||||
|
name="chhoto-url"
|
||||||
|
docker buildx build --push --tag sintan1729/$name:$v_major --tag sintan1729/$v_minor: \
|
||||||
|
--tag sintan1729/$name:$v_patch --tag sintan1729/$name:latest --platform linux/amd64,linux/arm64,linux/arm/v7 -f Dockerfile.multiarch .
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue