forked from drycc/registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
53 lines (45 loc) · 1.59 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
ARG CODENAME
FROM registry.drycc.cc/drycc/go-dev:latest AS build
ARG LDFLAGS
ADD . /workspace
RUN export GO111MODULE=on \
&& cd /workspace \
&& CGO_ENABLED=0 init-stack go build -ldflags "${LDFLAGS}" -o /usr/local/bin/registry main.go \
&& upx -9 --brute /usr/local/bin/registry
FROM registry.drycc.cc/drycc/base:${CODENAME}
ENV DRYCC_UID=1001 \
DRYCC_GID=1001 \
DRYCC_HOME_DIR=/var/lib/registry \
JQ_VERSION="1.6" \
MC_VERSION="2023.06.15.15.08.26" \
REGISTRY_VERSION="2.8.2"
COPY rootfs/bin/ /bin/
COPY --from=build /usr/local/bin/registry /opt/registry/bin/registry
RUN groupadd drycc --gid ${DRYCC_GID} \
&& useradd drycc -u ${DRYCC_UID} -g ${DRYCC_GID} -s /bin/bash -m -d ${DRYCC_HOME_DIR} \
&& install-packages apache2-utils \
&& install-stack jq $JQ_VERSION \
&& install-stack mc $MC_VERSION \
&& install-stack registry $REGISTRY_VERSION \
&& chmod +x /bin/init_registry \
&& rm -rf \
/usr/share/doc \
/usr/share/man \
/usr/share/info \
/usr/share/locale \
/var/lib/apt/lists/* \
/var/log/* \
/var/cache/debconf/* \
/etc/systemd \
/lib/lsb \
/lib/udev \
/usr/lib/`echo $(uname -m)`-linux-gnu/gconv/IBM* \
/usr/lib/`echo $(uname -m)`-linux-gnu/gconv/EBC* \
&& mkdir -p /usr/share/man/man{1..8} \
&& chown -R ${DRYCC_UID}:${DRYCC_GID} ${DRYCC_HOME_DIR}
COPY --chown=${DRYCC_UID}:${DRYCC_GID} rootfs/config-example.yml /opt/drycc/registry/etc/config.yml
ENV DRYCC_REGISTRY_CONFIG /opt/drycc/registry/etc/config.yml
USER ${DRYCC_UID}
VOLUME ["${DRYCC_HOME_DIR}"]
CMD ["/opt/registry/bin/registry"]
EXPOSE 5000