Skip to content

Commit e99e632

Browse files
author
lijianguo
committed
chore(dockerfile): use drycc/base image
1 parent 73f8787 commit e99e632

5 files changed

Lines changed: 55 additions & 12 deletions

File tree

Dockerfile

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,49 @@
1-
FROM docker.io/minio/mc:latest as mc
2-
3-
41
FROM docker.io/drycc/go-dev:latest AS build
52
ARG LDFLAGS
63
ADD . /app
74
RUN export GO111MODULE=on \
85
&& cd /app \
9-
&& CGO_ENABLED=0 go build -ldflags "${LDFLAGS}" -o /usr/local/bin/registry main.go \
6+
&& CGO_ENABLED=0 init-stack go build -ldflags "${LDFLAGS}" -o /usr/local/bin/registry main.go \
107
&& upx -9 --brute /usr/local/bin/registry
118

129

13-
FROM docker.io/library/registry:2.7
10+
FROM docker.io/drycc/base:bullseye
11+
12+
RUN adduser --system \
13+
--shell /bin/bash \
14+
--disabled-password \
15+
--home /var/lib/registry \
16+
--group \
17+
drycc
1418

15-
COPY rootfs /
16-
COPY --from=mc /usr/bin/mc /bin/mc
19+
COPY rootfs/bin/ /bin/
20+
COPY rootfs/config-example.yml /etc/docker/registry/config.yml
1721
COPY --from=build /usr/local/bin/registry /opt/registry/sbin/registry
22+
ENV JQ_VERSION="1.6" \
23+
MC_VERSION="2022.02.26.03.58.31" \
24+
REGISTRY_VERSION="2.8.0"
1825

19-
RUN apk add --no-cache jq bash \
20-
&& chmod +x /bin/create_bucket /bin/normalize_storage
26+
RUN install-stack jq $JQ_VERSION \
27+
&& install-stack mc $MC_VERSION \
28+
&& install-stack registry $REGISTRY_VERSION \
29+
&& chmod +x /bin/create_bucket /bin/normalize_storage \
30+
&& rm -rf \
31+
/usr/share/doc \
32+
/usr/share/man \
33+
/usr/share/info \
34+
/usr/share/locale \
35+
/var/lib/apt/lists/* \
36+
/var/log/* \
37+
/var/cache/debconf/* \
38+
/etc/systemd \
39+
/lib/lsb \
40+
/lib/udev \
41+
/usr/lib/`echo $(uname -m)`-linux-gnu/gconv/IBM* \
42+
/usr/lib/`echo $(uname -m)`-linux-gnu/gconv/EBC* \
43+
&& mkdir -p /usr/share/man/man{1..8} \
44+
&& chown -R drycc:drycc /var/lib/registry
2145

46+
USER drycc
2247
VOLUME ["/var/lib/registry"]
2348
CMD ["/opt/registry/sbin/registry"]
2449
EXPOSE 5000

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ SHELL_SCRIPTS = $(wildcard rootfs/bin/* _scripts/*.sh contrib/ci/*.sh)
1616
# The following variables describe the containerized development environment
1717
# and other build options
1818
DEV_ENV_IMAGE := ${DEV_REGISTRY}/drycc/go-dev
19-
DEV_ENV_WORK_DIR := /go/src/${REPO_PATH}
19+
DEV_ENV_WORK_DIR := /opt/drycc/go/src/${REPO_PATH}
2020
DEV_ENV_PREFIX := docker run --rm -v ${CURDIR}:${DEV_ENV_WORK_DIR} -w ${DEV_ENV_WORK_DIR}
2121
DEV_ENV_CMD := ${DEV_ENV_PREFIX} ${DEV_ENV_IMAGE}
2222
LDFLAGS := "-s -w -X main.version=${VERSION}"

contrib/ci/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ echo "1234567890123456789012345678901234567890" > "${CURRENT_DIR}"/tmp/aws-user/
1212

1313
MINIO_JOB=$(docker run -d --name minio \
1414
-v "${CURRENT_DIR}"/tmp/aws-user:/var/run/secrets/drycc/objectstore/creds \
15-
drycc/minio:canary server /home/minio/)
15+
drycc/minio:canary server /data/minio/)
1616

1717
sleep 5
1818
docker logs "${MINIO_JOB}"

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
const (
12-
registryBinary = "/bin/registry"
12+
registryBinary = "/opt/drycc/registry/bin/registry"
1313
registryConfig = "/etc/docker/registry/config.yml"
1414
minioHostEnvVar = "DRYCC_MINIO_SERVICE_HOST"
1515
minioPortEnvVar = "DRYCC_MINIO_SERVICE_PORT"

rootfs/config-example.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 0.1
2+
log:
3+
fields:
4+
service: registry
5+
storage:
6+
cache:
7+
blobdescriptor: inmemory
8+
filesystem:
9+
rootdirectory: /var/lib/registry
10+
http:
11+
addr: :5000
12+
headers:
13+
X-Content-Type-Options: [nosniff]
14+
health:
15+
storagedriver:
16+
enabled: true
17+
interval: 10s
18+
threshold: 3

0 commit comments

Comments
 (0)