Skip to content

Commit 77b6b44

Browse files
authored
feat(push & pull): implement push and pull (#185)
* feat(push & pull): implement push and pull Signed-off-by: mon3stera <[email protected]> fix: fix pull and push Signed-off-by: mon3stera <[email protected]> # Conflicts: # third-party/rust/crates/iterator-ext/0.2.1/.cargo-ok # third-party/rust/crates/iterator-ext/0.2.1/Cargo.toml # third-party/rust/crates/oci-client/0.15.0/.cargo-ok # third-party/rust/crates/oci-client/0.15.0/.github/dependabot.yml # third-party/rust/crates/oci-client/0.15.0/.github/workflows/build.yml # third-party/rust/crates/oci-client/0.15.0/.github/workflows/daily_security.yml # third-party/rust/crates/oci-client/0.15.0/.github/workflows/release.yml # third-party/rust/crates/oci-client/0.15.0/.gitignore # third-party/rust/crates/oci-client/0.15.0/BUCK # third-party/rust/crates/oci-client/0.15.0/CONTRIBUTING.md # third-party/rust/crates/oci-client/0.15.0/Cargo.toml # third-party/rust/crates/oci-client/0.15.0/Cargo.toml.orig # third-party/rust/crates/oci-client/0.15.0/LICENSE # third-party/rust/crates/oci-client/0.15.0/examples/get-manifest/main.rs # third-party/rust/crates/oci-client/0.15.0/examples/wasm/cli.rs # third-party/rust/crates/oci-client/0.15.0/examples/wasm/main.rs # third-party/rust/crates/oci-client/0.15.0/examples/wasm/pull.rs # third-party/rust/crates/oci-client/0.15.0/examples/wasm/push.rs # third-party/rust/crates/oci-client/0.15.0/justfile # third-party/rust/crates/oci-client/0.15.0/justfile-windows # third-party/rust/crates/oci-client/0.15.0/src/annotations.rs # third-party/rust/crates/oci-client/0.15.0/src/client.rs # third-party/rust/crates/oci-client/0.15.0/src/config.rs # third-party/rust/crates/oci-client/0.15.0/src/errors.rs # third-party/rust/crates/oci-client/0.15.0/src/lib.rs # third-party/rust/crates/oci-client/0.15.0/src/manifest.rs # third-party/rust/crates/oci-client/0.15.0/src/secrets.rs # third-party/rust/crates/oci-client/0.15.0/src/token_cache.rs # third-party/rust/crates/syn/2.0.106/tests/repo/mod.rs # Conflicts: # project/rkb/src/exec.rs * fix: update dockerfile Signed-off-by: mon3stera <[email protected]> * fix: use http in rkb and add test for pull and push Signed-off-by: mon3stera <[email protected]> fix: fix buck2 Signed-off-by: mon3stera <[email protected]> format: cargo clippy Signed-off-by: mon3stera <[email protected]> fix: fix buck2 build Signed-off-by: mon3stera <[email protected]> # Conflicts: # project/rkb/BUCK * fix: update .env and compose Signed-off-by: mon3stera <[email protected]> * doc: add more comments Signed-off-by: mon3stera <[email protected]> * fix: fix buck2 build Signed-off-by: mon3stera <[email protected]> * fix: remove useless third-party codes Signed-off-by: mon3stera <[email protected]> * refactor: use `logname` to get original username directly so that we can escape from trick Signed-off-by: mon3stera <[email protected]> * fix: fix buck2 build Signed-off-by: mon3stera <[email protected]> * fix: resolve conflicting Signed-off-by: mon3stera <[email protected]> * format: cargo fmt Signed-off-by: mon3stera <[email protected]> --------- Signed-off-by: mon3stera <[email protected]>
1 parent 7bc602f commit 77b6b44

File tree

107 files changed

+2038
-478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+2038
-478
lines changed

project/Cargo.lock

Lines changed: 40 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

project/distribution/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ JWT_SECRET="secret"
1616
JWT_LIFETIME_SECONDS=3600
1717

1818
RUST_LOG="info"
19+
PROFILE=debug
1920

2021
GITHUB_CLIENT_ID=github_client_id
2122
GITHUB_CLIENT_SECRET=github_client_secret

project/distribution/Dockerfile

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,36 @@
11
FROM rust:1-slim as builder
22

3+
ARG PROFILE=debug
4+
35
WORKDIR /usr/src/app
46

7+
# Install necessary packages for building Rust applications with OpenSSL
8+
RUN apt-get update && apt-get install -y \
9+
pkg-config \
10+
libssl-dev \
11+
&& rm -rf /var/lib/apt/lists/*
12+
513
RUN cargo init --bin .
614
COPY Cargo.toml ./
7-
RUN cargo build --release
15+
16+
RUN if [ "$PROFILE" = "release" ]; then \
17+
cargo build --release; \
18+
else \
19+
cargo build; \
20+
fi
821

922
COPY src ./src
1023
COPY migrations ./migrations
11-
RUN touch src/main.rs && cargo build --release
24+
RUN touch src/main.rs && \
25+
if [ "$PROFILE" = "release" ]; then \
26+
cargo build --release; \
27+
else \
28+
cargo build; \
29+
fi
1230

1331
FROM debian:stable-slim
1432

33+
ARG PROFILE=debug
1534
ARG OCI_REGISTRY_ROOTDIR=/var/lib/oci-registry
1635
ARG OCI_REGISTRY_PORT=8968
1736

@@ -23,7 +42,13 @@ ARG GID=1001
2342
RUN groupadd -g $GID $APP_GROUP && \
2443
useradd -u $UID -g $APP_GROUP -s /bin/sh -m $APP_USER
2544

26-
COPY --from=builder /usr/src/app/target/release/distribution /usr/local/bin/distribution
45+
COPY --from=builder /usr/src/app/target/ /tmp/target/
46+
RUN if [ "$PROFILE" = "release" ]; then \
47+
cp /tmp/target/release/distribution /usr/local/bin/distribution; \
48+
else \
49+
cp /tmp/target/debug/distribution /usr/local/bin/distribution; \
50+
fi && \
51+
chmod +x /usr/local/bin/distribution
2752

2853
RUN mkdir -p ${OCI_REGISTRY_ROOTDIR} && chown -R $APP_USER:$APP_GROUP ${OCI_REGISTRY_ROOTDIR}
2954

@@ -33,4 +58,4 @@ WORKDIR ${OCI_REGISTRY_ROOTDIR}
3358

3459
EXPOSE ${OCI_REGISTRY_PORT}
3560

36-
CMD ["distribution"]
61+
CMD ["distribution"]

project/distribution/compose.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ services:
44
context: .
55
dockerfile: Dockerfile
66
args:
7+
PROFILE: ${PROFILE:-debug}
78
OCI_REGISTRY_PORT: ${OCI_REGISTRY_PORT}
89
OCI_REGISTRY_ROOTDIR: ${OCI_REGISTRY_ROOTDIR}
910
restart: unless-stopped
@@ -12,6 +13,8 @@ services:
1213
volumes:
1314
- registry_data:${OCI_REGISTRY_ROOTDIR}
1415
environment:
16+
PROFILE: ${PROFILE}
17+
1518
DATABASE_URL: "postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}"
1619

1720
OCI_REGISTRY_URL: ${OCI_REGISTRY_URL}
@@ -20,10 +23,12 @@ services:
2023
OCI_REGISTRY_ROOTDIR: ${OCI_REGISTRY_ROOTDIR}
2124
OCI_REGISTRY_PUBLIC_URL: ${OCI_REGISTRY_PUBLIC_URL}
2225

23-
PASSWORD_SALT: ${PASSWORD_SALT}
2426
JWT_SECRET: ${JWT_SECRET}
2527
JWT_LIFETIME_SECONDS: ${JWT_LIFETIME_SECONDS}
2628
RUST_LOG: ${RUST_LOG}
29+
30+
GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID}
31+
GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET}
2732
depends_on:
2833
- db
2934

project/libcni/BUCK

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ cargo.rust_library(
3737
"//third-party/rust/crates/futures/0.3.31:futures",
3838
"//third-party/rust/crates/ipnetwork/0.17.0:ipnetwork",
3939
"//third-party/rust/crates/json/0.12.4:json",
40-
"//third-party/rust/crates/libc/0.2.175:libc",
40+
"//third-party/rust/crates/libc/0.2.176:libc",
4141
"//third-party/rust/crates/log/0.4.28:log",
4242
"//third-party/rust/crates/macaddr/1.0.1:macaddr",
4343
"//third-party/rust/crates/netlink-packet-route/0.22.0:netlink-packet-route",

project/libcontainer/BUCK

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ cargo.rust_library(
4141
"//third-party/rust/crates/caps/0.5.5:caps",
4242
"//third-party/rust/crates/chrono/0.4.42:chrono",
4343
"//third-party/rust/crates/fastrand/2.3.0:fastrand",
44-
"//third-party/rust/crates/libc/0.2.175:libc",
44+
"//third-party/rust/crates/libc/0.2.176:libc",
4545
"//third-party/rust/crates/libseccomp/0.3.0:libseccomp",
4646
"//third-party/rust/crates/nc/0.9.6:nc",
4747
"//third-party/rust/crates/nix/0.29.0:nix",

project/libfuse-fs/BUCK

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ cargo.rust_library(
3535
"//third-party/rust/crates/clap/4.5.48:clap",
3636
"//third-party/rust/crates/futures-util/0.3.31:futures-util",
3737
"//third-party/rust/crates/futures/0.3.31:futures",
38-
"//third-party/rust/crates/libc/0.2.175:libc",
38+
"//third-party/rust/crates/libc/0.2.176:libc",
3939
"//third-party/rust/crates/memmap2/0.9.8:memmap2",
4040
"//third-party/rust/crates/moka/0.12.11:moka",
4141
"//third-party/rust/crates/nix/0.29.0:nix",

project/libipam/BUCK

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ cargo.rust_binary(
3939
"//third-party/rust/crates/semver/0.11.0:semver",
4040
"//third-party/rust/crates/serde/1.0.226:serde",
4141
"//third-party/rust/crates/serde_json/1.0.145:serde_json",
42-
"//third-party/rust/crates/tempfile/3.22.0:tempfile",
42+
"//third-party/rust/crates/tempfile/3.23.0:tempfile",
4343
"//third-party/rust/crates/thiserror/2.0.16:thiserror",
4444
"//third-party/rust/crates/tokio/1.47.1:tokio",
4545
],

project/rfuse3/BUCK

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ cargo.rust_library(
4040
"//third-party/rust/crates/bytes/1.10.1:bytes",
4141
"//third-party/rust/crates/futures-channel/0.3.31:futures-channel",
4242
"//third-party/rust/crates/futures-util/0.3.31:futures-util",
43-
"//third-party/rust/crates/libc/0.2.175:libc",
43+
"//third-party/rust/crates/libc/0.2.176:libc",
4444
"//third-party/rust/crates/nix/0.29.0:nix",
4545
"//third-party/rust/crates/serde/1.0.226:serde",
4646
"//third-party/rust/crates/slab/0.4.11:slab",

0 commit comments

Comments
 (0)