Skip to content

Commit f866599

Browse files
committed
chore(registry): change env to build arg
1 parent 78e4360 commit f866599

5 files changed

Lines changed: 22 additions & 19 deletions

File tree

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ RUN export GO111MODULE=on \
1111

1212
FROM registry.drycc.cc/drycc/base:${CODENAME}
1313

14-
ENV DRYCC_UID=1001 \
14+
ARG DRYCC_UID=1001 \
1515
DRYCC_GID=1001 \
1616
DRYCC_HOME_DIR=/var/lib/registry \
1717
JQ_VERSION="1.7.1" \
18-
MC_VERSION="2025.08.13.08.35.41" \
1918
NGINX_VERSION="1.29.1" \
19+
RCLONE_VERSION="1.71.1" \
2020
REGISTRY_VERSION="3.0.0"
2121

2222
RUN groupadd drycc --gid ${DRYCC_GID} \
2323
&& useradd drycc -u ${DRYCC_UID} -g ${DRYCC_GID} -s /bin/bash -m -d ${DRYCC_HOME_DIR} \
2424
&& install-packages apache2-utils \
2525
&& install-stack jq $JQ_VERSION \
26-
&& install-stack mc $MC_VERSION \
2726
&& install-stack nginx ${NGINX_VERSION} \
27+
&& install-stack rclone $RCLONE_VERSION \
2828
&& install-stack registry $REGISTRY_VERSION \
2929
&& rm -rf \
3030
/usr/share/doc \

charts/registry/templates/_helper.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@ env:
6666
name: storage-creds
6767
key: secretkey
6868
- name: "DRYCC_STORAGE_PATH_STYLE"
69-
value: "on"
69+
value: "true"
7070
{{- end }}
7171
{{- end }}

contrib/ci/test.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ DRYCC_STORAGE_SECRETKEY=f4c4281665bc11ee8e0400163e04a9cd
77

88

99
STORAGE_JOB=$(podman run -d --rm --entrypoint init-stack \
10-
-e MINIO_ROOT_USER="${DRYCC_STORAGE_ACCESSKEY}" \
11-
-e MINIO_ROOT_PASSWORD="${DRYCC_STORAGE_SECRETKEY}" \
12-
"${DEV_REGISTRY}"/drycc/storage:canary minio server /data)
10+
-e RUSTFS_ACCESS_KEY="${DRYCC_STORAGE_ACCESSKEY}" \
11+
-e RUSTFS_SECRET_KEY="${DRYCC_STORAGE_SECRETKEY}" \
12+
"${DEV_REGISTRY}"/drycc/storage:canary rustfs /data)
1313

1414
# wait for port
1515
STORAGE_IP=$(podman inspect --format "{{ .NetworkSettings.IPAddress }}" "${STORAGE_JOB}")
@@ -26,7 +26,7 @@ REGISTRY_JOB=$(podman run -d --rm \
2626
-e DRYCC_STORAGE_ENDPOINT="http://${STORAGE_IP}:9000" \
2727
-e DRYCC_STORAGE_ACCESSKEY="${DRYCC_STORAGE_ACCESSKEY}" \
2828
-e DRYCC_STORAGE_SECRETKEY="${DRYCC_STORAGE_SECRETKEY}" \
29-
-e DRYCC_STORAGE_PATH_STYLE=on \
29+
-e DRYCC_STORAGE_PATH_STYLE=true \
3030
"$1" start-registry)
3131

3232
# shellcheck disable=SC2317

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func main() {
4040
os.Setenv("REGISTRY_STORAGE_S3_SECRETKEY", os.Getenv(storageSecretkeyEnvVar))
4141
os.Setenv("REGISTRY_STORAGE_S3_BUCKET", os.Getenv(storageBucketEnvVar))
4242

43-
if os.Getenv(storagePathStyleEnvVar) == "on" {
43+
if os.Getenv(storagePathStyleEnvVar) == "true" {
4444
os.Setenv("REGISTRY_STORAGE_S3_FORCEPATHSTYLE", "true")
4545
}
4646

rootfs/bin/init-registry

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22

33
set -e
44

5-
mc alias set storage \
6-
"${DRYCC_STORAGE_ENDPOINT}" \
7-
"${DRYCC_STORAGE_ACCESSKEY}" \
8-
"${DRYCC_STORAGE_SECRETKEY}" \
9-
--path "${DRYCC_STORAGE_PATH_STYLE}"
105

11-
mc ping storage -x
12-
if ! mc admin info storage > /dev/null 2>&1; then
6+
mkdir -p ~/.config/rclone
7+
touch ~/.config/rclone/rclone.conf
8+
rclone config create storage s3 \
9+
provider=Other \
10+
access_key_id="${DRYCC_STORAGE_ACCESSKEY}" \
11+
secret_access_key="${DRYCC_STORAGE_SECRETKEY}" \
12+
endpoint="${DRYCC_STORAGE_ENDPOINT}" \
13+
force_path_style="${DRYCC_STORAGE_PATH_STYLE:-true}" --no-output
14+
15+
if ! rclone lsd storage: > /dev/null 2>&1; then
1316
sleep 9s
14-
else
15-
mc ready storage
17+
echo "waiting for object storage to become ready..."
1618
fi
17-
mc mb --ignore-existing storage/"${DRYCC_STORAGE_BUCKET}"
19+
20+
rclone mkdir "storage:${DRYCC_STORAGE_BUCKET}"
1821

1922
htpasswd -Bbn "${DRYCC_REGISTRY_USERNAME}" "${DRYCC_REGISTRY_PASSWORD}" > "${REGISTRY_AUTH_HTPASSWD_PATH}"
2023
echo "create ${REGISTRY_AUTH_HTPASSWD_PATH} success"

0 commit comments

Comments
 (0)