diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c92dc9b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +target +LICENSE +README.md +.env \ No newline at end of file diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..c08d3a4 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,43 @@ +--- +kind: pipeline +type: docker +name: default + +steps: + - name: publish sha + image: banzaicloud/drone-kaniko + settings: + registry: registry.fromouter.space + repo: uchumoe/sourcehut-mirror-bridge + cache: true + username: + from_secret: docker_username + password: + from_secret: docker_password + tags: + - latest + - ${DRONE_COMMIT_SHA} + when: + event: + - push + + - name: publish tag + image: banzaicloud/drone-kaniko + settings: + registry: registry.fromouter.space + repo: uchumoe/sourcehut-mirror-bridge + cache: true + username: + from_secret: docker_username + password: + from_secret: docker_password + tags: + - ${DRONE_COMMIT_BRANCH} + when: + event: + - tag +--- +kind: signature +hmac: 925643c1816fd7df3823079bc98a79836e34e4641b8328ae0bc3eae37923ff84 + +... diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..67b344a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM public.ecr.aws/docker/library/rust:1-alpine as builder + +RUN rustup default stable +RUN apk add --no-cache musl-dev openssl-dev openssl-libs-static pkgconf git + +# Set `SYSROOT` to a dummy path (default is /usr) because pkg-config-rs *always* +# links those located in that path dynamically but we want static linking, c.f. +# https://github.com/rust-lang/pkg-config-rs/blob/54325785816695df031cef3b26b6a9a203bbc01b/src/lib.rs#L613 +ENV SYSROOT=/dummy + +WORKDIR /wd +COPY . /wd +RUN cargo build --release --target=x86_64-unknown-linux-musl + +FROM public.ecr.aws/docker/library/alpine +ARG version=unknown +ARG release=unreleased + +COPY --from=builder /wd/target/x86_64-unknown-linux-musl/release/sourcehut-mirror-bridge /usr/local/bin/ +CMD ["sourcehut-mirror-bridge"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..36c3eff --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# sourcehut-mirror-bridge + +SourceHut to Gitea active mirror bridge. Uses Soucehut GQL APIs to set up a webhook and manually sync a downstream Gitea/Forgejo repository set as a mirror. + +Use case: You're running Drone CI or others linked to a Gitea instance and you want them to run as soon as possible. \ No newline at end of file