-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile-minimal
62 lines (49 loc) · 2.09 KB
/
Dockerfile-minimal
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
# Copyright 2022 Harness Inc. All rights reserved.
# Use of this source code is governed by the PolyForm Free Trial 1.0.0 license
# that can be found in the licenses directory at the root of this repository, also available at
# https://polyformproject.org/wp-content/uploads/2020/05/PolyForm-Free-Trial-1.0.0.txt.
FROM redhat/ubi8-minimal:8.10
LABEL name="harness/delegate-minimal" \
vendor="Harness" \
maintainer="Harness"
RUN microdnf update --nodocs --setopt=install_weak_deps=0 \
&& microdnf install --nodocs \
procps \
hostname \
lsof \
findutils \
tar \
gzip \
shadow-utils \
glibc-langpack-en \
&& useradd -u 1001 -g 0 harness \
&& microdnf remove shadow-utils \
&& microdnf clean all \
&& rm -rf /var/cache/yum \
&& mkdir -p /opt/harness-delegate/
COPY immutable-scripts /opt/harness-delegate/
WORKDIR /opt/harness-delegate
ARG TARGETARCH
ENV TARGETARCH=${TARGETARCH:-amd64}
ARG BASEURL=https://app.harness.io/public/shared/delegates
ARG DELEGATEVERSION
COPY --from=eclipse-temurin:17.0.11_9-jre-ubi9-minimal /opt/java/openjdk/ /opt/java/openjdk/
ENV JAVA_HOME=/opt/java/openjdk
RUN set -o pipefail \
&& mkdir -m 777 -p client-tools/scm/f52a6de3e \
&& curl -f -s -L -o client-tools/scm/f52a6de3e/scm https://app.harness.io/public/shared/tools/scm/release/f52a6de3e/bin/linux/$TARGETARCH/scm || { echo "Failed to download scm"; exit 1; } \
&& curl -f -s -L -o $JAVA_HOME/bin/jattach https://app.harness.io/public/shared/tools/jattach/release/v2.2/bin/linux/$TARGETARCH/jattach || { echo "Failed to download jattach"; exit 1; } \
&& chmod +x $JAVA_HOME/bin/jattach \
&& chmod -R 775 /opt/harness-delegate \
&& chgrp -R 0 /opt/harness-delegate \
&& chown -R 1001 /opt/harness-delegate \
&& chown -R 1001 $JAVA_HOME/lib/security/cacerts
ENV LANG=en_US.UTF-8
ENV HOME=/opt/harness-delegate
ENV CLIENT_TOOLS_DOWNLOAD_DISABLED=true
ENV INSTALL_CLIENT_TOOLS_IN_BACKGROUND=true
ENV PATH="$JAVA_HOME/bin:${PATH}"
ENV PATH="$JAVA_HOME/bin/jattach:${PATH}"
RUN curl -s -L -o delegate.jar $BASEURL/$DELEGATEVERSION/delegate.jar
USER 1001
CMD [ "./start.sh" ]