mirror of
https://codeberg.org/librarian/stream-proxy
synced 2024-12-06 19:26:34 +01:00
Optimize CI [skip ci]
This commit is contained in:
+20
-21
@@ -1,28 +1,10 @@
|
|||||||
variables:
|
variables:
|
||||||
DOCKER_HOST: tcp://docker:2375
|
DOCKER_HOST: tcp://docker:2375
|
||||||
|
|
||||||
bin:
|
docker:
|
||||||
|
image: docker:20
|
||||||
stage: build
|
stage: build
|
||||||
needs: []
|
needs: []
|
||||||
image: rust:alpine
|
|
||||||
cache:
|
|
||||||
- key:
|
|
||||||
files:
|
|
||||||
- Cargo.toml
|
|
||||||
- Cargo.lock
|
|
||||||
paths:
|
|
||||||
- vendor/
|
|
||||||
script:
|
|
||||||
- mkdir ~/.cargo && mv config/cargo.toml ~/.cargo/config.toml
|
|
||||||
- cargo vendor
|
|
||||||
- cargo build --release
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- target/release/stream-proxy
|
|
||||||
|
|
||||||
build:
|
|
||||||
image: docker:20
|
|
||||||
stage: deploy
|
|
||||||
services:
|
services:
|
||||||
- name: docker:20-dind
|
- name: docker:20-dind
|
||||||
command: ["--experimental"]
|
command: ["--experimental"]
|
||||||
@@ -36,4 +18,21 @@ build:
|
|||||||
- docker context create mybuilder
|
- docker context create mybuilder
|
||||||
- docker buildx create --use --name mybuilder mybuilder
|
- docker buildx create --use --name mybuilder mybuilder
|
||||||
- docker pull $CI_REGISTRY_IMAGE:latest || true
|
- docker pull $CI_REGISTRY_IMAGE:latest || true
|
||||||
- docker buildx build --cache-from $CI_REGISTRY_IMAGE:latest --platform linux/amd64 --push -t $CI_REGISTRY_IMAGE:latest .
|
- docker buildx build --cache-from $CI_REGISTRY_IMAGE:latest --platform linux/amd64 --push -t $CI_REGISTRY_IMAGE:latest .
|
||||||
|
- docker run --rm $CI_REGISTRY_IMAGE:latest cat /app/stream-proxy > stream-proxy
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- stream-proxy
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
image: alpine:latest
|
||||||
|
stage: deploy
|
||||||
|
needs:
|
||||||
|
- docker
|
||||||
|
before_script:
|
||||||
|
- apk update && apk --no-cache add curl git
|
||||||
|
- wget -O - https://fly.io/install.sh | sh
|
||||||
|
- git clone https://codeberg.org/video-prize-ranch/fly-cfg
|
||||||
|
- cd fly-cfg/librarian
|
||||||
|
script:
|
||||||
|
- /root/.fly/bin/flyctl deploy --no-cache --detach
|
||||||
+12
-8
@@ -1,17 +1,21 @@
|
|||||||
FROM rust:alpine AS build
|
FROM lukemathwalker/cargo-chef:latest-rust-alpine AS chef
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
RUN apk --no-cache add musl-dev git ca-certificates
|
|
||||||
RUN git clone https://codeberg.org/librarian/stream-proxy .
|
|
||||||
|
|
||||||
RUN mkdir ~/.cargo && mv config/cargo.toml ~/.cargo/config.toml
|
FROM chef AS planner
|
||||||
RUN cargo vendor
|
COPY . .
|
||||||
RUN cargo build --release
|
RUN cargo chef prepare --recipe-path recipe.json
|
||||||
|
|
||||||
|
FROM chef AS builder
|
||||||
|
COPY --from=planner /src/recipe.json recipe.json
|
||||||
|
RUN cargo chef cook --release --recipe-path recipe.json
|
||||||
|
COPY . .
|
||||||
|
ENV CARGO_INCREMENTAL=0
|
||||||
|
RUN cargo build --release --bin stream-proxy
|
||||||
|
|
||||||
FROM alpine:latest as bin
|
FROM alpine:latest as bin
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=build /src/target/release/stream-proxy .
|
COPY --from=builder /src/target/release/stream-proxy .
|
||||||
|
|
||||||
EXPOSE 3001
|
EXPOSE 3001
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
[source.crates-io]
|
|
||||||
replace-with = "vendored-sources"
|
|
||||||
|
|
||||||
[source.vendored-sources]
|
|
||||||
directory = "vendor"
|
|
||||||
Reference in New Issue
Block a user