-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
128 lines (110 loc) · 3.86 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Base image Stage 1
FROM debian:stable-20220711-slim as stage1
ARG DOCKER_HUB_URL=https://hub.docker.com/repository/docker/
ARG DOCKER_HUB_HOST=ochmanskide
ARG IMAGE_SOURCE="https://github.com/ochmanskide/base.images.debian.11-bullseye.mandrel.22-2.java.17.mandrel-22-2-gradle-7-5-java-17"
ARG JAVA_VERSION="17.0.4"
ARG JAVA_HOME="/opt/graalvm"
ARG GRAALVM_HOME="/opt/graalvm"
ARG GRADLE_HOME="/opt/gradle"
ARG GRADLE_VERSION="7.5"
ARG DEBIAN_FRONTEND=noninteractive
ARG LC_ALL=C
ARG BASE_LAYER_CACHE_KEY
ENV DOWNLOADS=/downloads \
DOCKER_HUB_HOST=${DOCKER_HUB_HOST} \
DOCKER_HUB_URL=${DOCKER_HUB_URL} \
IMAGE_SOURCE=${IMAGE_SOURCE} \
JAVA_HOME=${JAVA_HOME} \
GRAALVM_HOME=${GRAALVM_HOME} \
GRADLE_HOME=${GRADLE_HOME} \
GRADLE_VERSION=${GRADLE_VERSION} \
JAVA_VERSION=${JAVA_VERSION} \
DEBIAN_FRONTEND=${DEBIAN_FRONTEND} \
PATH="${JAVA_HOME}/bin:${PATH}"
USER root
SHELL ["/bin/bash", "-c"]
COPY scripts/install/ /scripts/
COPY scripts/home/ /home/
COPY scripts/home/docker/dockerd-entrypoint.sh /usr/local/bin/
RUN /scripts/01-install-tools.sh
RUN /scripts/02-install-packages.sh
RUN . /scripts/03-download-mandrel.sh
RUN . /scripts/04-install-native-image-tool.sh
RUN /scripts/06-download-docker-cli.sh
RUN /scripts/06-install-docker-cli.sh
VOLUME /var/lib/docker
RUN /scripts/08-install-gradle.sh
RUN /scripts/09-clean-apt-cache.sh
RUN /scripts/11-config-git.sh
RUN rm -f /home/gradle/xx*
# Stage 2
FROM debian:stable-20220711-slim
ARG DOCKER_HUB_URL=https://hub.docker.com/repository/docker/
ARG DOCKER_HUB_HOST=ochmanskide
ARG IMAGE_SOURCE="https://github.com/ochmanskide/base.images.debian.11-bullseye.mandrel.22-2.java.17.mandrel-22-2-gradle-7-5-java-17"
ARG JAVA_VERSION="17.0.4"
ARG JAVA_HOME="/opt/graalvm"
ARG GRAALVM_HOME="/opt/graalvm"
ARG GRADLE_HOME="/opt/gradle"
ARG GRADLE_USER_HOME="/home/gradle/.gradle"
ARG GRADLE_VERSION="7.5"
ARG DEBIAN_FRONTEND=noninteractive
ENV DOWNLOADS=/downloads \
DOCKER_HUB_HOST=${DOCKER_HUB_HOST} \
DOCKER_HUB_URL=${DOCKER_HUB_URL} \
IMAGE_SOURCE=${IMAGE_SOURCE} \
JAVA_HOME=${JAVA_HOME} \
GRAALVM_HOME=${GRAALVM_HOME} \
GRADLE_HOME=${GRADLE_HOME} \
GRADLE_USER_HOME=${GRADLE_USER_HOME} \
GRADLE_VERSION=${GRADLE_VERSION} \
JAVA_VERSION=${JAVA_VERSION} \
DEBIAN_FRONTEND=${DEBIAN_FRONTEND} \
PATH="${JAVA_HOME}/bin:${PATH}"
LABEL git.branch=${CI_COMMIT_BRANCH} \
git.commit=${CI_COMMIT_SHA} \
git.tag=${CI_COMMIT_TAG} \
git.source=${IMAGE_SOURCE}
COPY scripts/install/ /scripts/
COPY scripts/home/ /home/
COPY scripts/home/docker/dockerd-entrypoint.sh /usr/local/bin/
# 369M
COPY --from=stage1 /opt/graalvm/ /opt/graalvm/
# 124M
COPY --from=stage1 /opt/gradle/ /opt/gradle/
# 51M
COPY --from=stage1 /usr/local/bin/docker /usr/local/bin/docker
# 62M
COPY --from=stage1 /usr/local/bin/dockerd /usr/local/bin/dockerd
# 34.0K
COPY --from=stage1 /usr/local/bin/dind /usr/local/bin/dind
# 33M
COPY --from=stage1 /usr/local/bin/containerd /usr/local/bin/containerd
# 8404K
COPY --from=stage1 /usr/local/bin/docker-init /usr/local/bin/docker-init
SHELL ["/bin/bash", "-c"]
# build-essential (10MB)
# libz-dev (0M)
# zlib1g-dev - 196MB
# iptables (0M)
# runc 8404K
# llvm (150MB)
# Git - 70MB
# Total: 426 MB
RUN ln -s /opt/gradle/bin/gradle /usr/bin/gradle \
&& ln -s /home/gradle/.gradle /root/.gradle \
&& apt-get clean \
&& apt-get update -y \
&& apt-get install --no-install-recommends -y bc ca-certificates build-essential libz-dev zlib1g-dev iptables runc git \
&& /scripts/06-install-docker-cli.sh \
&& /scripts/11-config-git.sh \
&& apt-get autoclean \
&& apt-get autoremove -y \
&& rm -rf /var/cache/apt/* \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& apt-get clean
WORKDIR /home/gradle
VOLUME /var/lib/docker
SHELL ["/bin/bash", "-c", "source /home/gradle/.bash_aliases"]
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh"]