-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
89 lines (74 loc) · 2.48 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# syntax=docker/dockerfile:1
# The base image to use
FROM debian:bullseye
# The maintainer of this Dockerfile
LABEL maintainer="Didstopia <support@didstopia.com>"
# Set the default environment variables
ENV WORKSPACE_PATH=""
ENV REPO_DEFAULT_DISTRIBUTION="bullseye" \
REPO_DEFAULT_COMPONENT="main" \
REPO_DEFAULT_COMPONENTS="main,contrib,non-free"
ENV REPO_DIR="/repo" \
REPO_PACKAGES_DIR="/packages" \
REPO_KEYS_DIR="/keys"
ENV REPO_ORIGIN="Example Repository" \
REPO_LABEL="Example Repository" \
REPO_VERSION="1.0" \
REPO_DESCRIPTION="This is an example repository."
ENV REPO_KEY_TYPE="RSA" \
REPO_KEY_LENGTH="4096" \
REPO_KEY_EXPIRE="0" \
REPO_KEY_NAME="Example Key" \
REPO_KEY_EMAIL="example@example.com" \
REPO_KEY_COMMENT="This is an example key." \
REPO_KEY_PASSPHRASE="" \
REPO_KEY_PUBLIC="" \
REPO_KEY_PRIVATE="" \
REPO_KEY_PUBLIC_PATH="${REPO_KEYS_DIR}/public.key" \
REPO_KEY_PRIVATE_PATH="${REPO_KEYS_DIR}/private.key"
# Install the necessary tools
RUN apt-get update && \
apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
dpkg-dev \
gpg \
gpg-agent
# Create the necessary directories
RUN mkdir -p "${REPO_DIR}" "${REPO_PACKAGES_DIR}" "${REPO_KEYS_DIR}"
# Copy the entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
## FIXME: Once the verification script is fixed, uncomment it below!
# Copy the other scripts
COPY update.sh /usr/local/bin/repo-update
COPY verify.sh /usr/local/bin/repo-verify
RUN echo "#!/usr/bin/env bash" > /usr/local/bin/repo-all && \
echo "#set -eo pipefail" >> /usr/local/bin/repo-all && \
echo "repo-update" >> /usr/local/bin/repo-all && \
echo "#repo-verify ${REPO_DIR}" >> /usr/local/bin/repo-all
RUN chmod a+x /usr/local/bin/repo-*
# Setup gosu for running as a non-root user
RUN set -eux; \
apt-get update; \
apt-get install -y gosu; \
rm -rf /var/lib/apt/lists/*; \
gosu nobody true
# Set default timezone
ENV TZ=UTC
# Set the default non-root user id and group id
ENV PUID=1000
ENV PGID=1000
ENV USER=docker
ENV GROUP=docker
# Set default permissions
RUN chown -R "${PUID}":"${PGID}" "${REPO_DIR}" "${REPO_PACKAGES_DIR}" "${REPO_KEYS_DIR}"
# Set the default working directory
WORKDIR /repo
# Set the volumes
VOLUME [ "${REPO_DIR}}", "${REPO_PACKAGES_DIR}", "${REPO_KEYS_DIR}" ]
# Set the entrypoint
ENTRYPOINT [ "/entrypoint.sh" ]
# Set the default command
CMD [ "repo-all" ]