This repository has been archived by the owner on Feb 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
117 lines (99 loc) · 5.73 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
# Copyright 2018 ThoughtWorks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################################
# This file is autogenerated by the repository at https://github.com/gocd/docker-gocd-agent.
# Please file any issues or PRs at https://github.com/gocd/docker-gocd-agent
###############################################################################################
FROM alpine:latest as gocd-agent-unzip
ARG UID=1000
RUN \
apk --no-cache upgrade && \
apk add --no-cache curl && \
curl --fail --location --silent --show-error "https://download.gocd.org/binaries/20.3.0-11530/generic/go-agent-20.3.0-11530.zip" > /tmp/go-agent-20.3.0-11530.zip
RUN unzip /tmp/go-agent-20.3.0-11530.zip -d /
RUN mv /go-agent-20.3.0 /go-agent && chown -R ${UID}:0 /go-agent && chmod -R g=u /go-agent
FROM alpine:3.8
MAINTAINER ThoughtWorks, Inc. <support@thoughtworks.com>
LABEL gocd.version="20.3.0" \
description="GoCD agent based on alpine version 3.8" \
maintainer="ThoughtWorks, Inc. <support@thoughtworks.com>" \
url="https://www.gocd.org" \
gocd.full.version="20.3.0-11530" \
gocd.git.sha="f54d0bae7a39fe7add5460f3f8676a7936abf698"
ADD https://github.com/krallin/tini/releases/download/v0.18.0/tini-static-amd64 /usr/local/sbin/tini
# force encoding
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV GO_JAVA_HOME="/gocd-jre"
ARG UID=1000
ARG GID=1000
RUN \
# add mode and permissions for files we added above
chmod 0755 /usr/local/sbin/tini && \
chown root:root /usr/local/sbin/tini && \
# add our user and group first to make sure their IDs get assigned consistently,
# regardless of whatever dependencies get added
# add user to root group for gocd to work on openshift
adduser -D -u ${UID} -s /bin/bash -G root go && \
apk add --no-cache cyrus-sasl && \
apk --no-cache upgrade && \
apk add --no-cache nss git mercurial subversion openssh-client bash curl procps && \
# install glibc and zlib for adoptopenjdk && \
# See https://github.com/AdoptOpenJDK/openjdk-docker/blob/ce8b120411b131e283106ab89ea5921ebb1d1759/8/jdk/alpine/Dockerfile.hotspot.releases.slim#L24-L54 && \
apk add --no-cache --virtual .build-deps curl binutils && \
GLIBC_VER="2.29-r0" && \
ALPINE_GLIBC_REPO="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" && \
GCC_LIBS_URL="https://archive.archlinux.org/packages/g/gcc-libs/gcc-libs-9.1.0-2-x86_64.pkg.tar.xz" && \
GCC_LIBS_SHA256=91dba90f3c20d32fcf7f1dbe91523653018aa0b8d2230b00f822f6722804cf08 && \
ZLIB_URL="https://archive.archlinux.org/packages/z/zlib/zlib-1%3A1.2.11-3-x86_64.pkg.tar.xz" && \
ZLIB_SHA256=17aede0b9f8baa789c5aa3f358fbf8c68a5f1228c5e6cba1a5dd34102ef4d4e5 && \
curl -LfsS https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub && \
SGERRAND_RSA_SHA256="823b54589c93b02497f1ba4dc622eaef9c813e6b0f0ebbb2f771e32adf9f4ef2" && \
echo "${SGERRAND_RSA_SHA256} */etc/apk/keys/sgerrand.rsa.pub" | sha256sum -c - && \
curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-${GLIBC_VER}.apk > /tmp/glibc-${GLIBC_VER}.apk && \
apk add /tmp/glibc-${GLIBC_VER}.apk && \
curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk > /tmp/glibc-bin-${GLIBC_VER}.apk && \
apk add /tmp/glibc-bin-${GLIBC_VER}.apk && \
curl -Ls ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk > /tmp/glibc-i18n-${GLIBC_VER}.apk && \
apk add /tmp/glibc-i18n-${GLIBC_VER}.apk && \
/usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true && \
echo "export LANG=$LANG" > /etc/profile.d/locale.sh && \
curl -LfsS ${GCC_LIBS_URL} -o /tmp/gcc-libs.tar.xz && \
echo "${GCC_LIBS_SHA256} */tmp/gcc-libs.tar.xz" | sha256sum -c - && \
mkdir /tmp/gcc && \
tar -xf /tmp/gcc-libs.tar.xz -C /tmp/gcc && \
mv /tmp/gcc/usr/lib/libgcc* /tmp/gcc/usr/lib/libstdc++* /usr/glibc-compat/lib && \
strip /usr/glibc-compat/lib/libgcc_s.so.* /usr/glibc-compat/lib/libstdc++.so* && \
curl -LfsS ${ZLIB_URL} -o /tmp/libz.tar.xz && \
echo "${ZLIB_SHA256} */tmp/libz.tar.xz" | sha256sum -c - && \
mkdir /tmp/libz && \
tar -xf /tmp/libz.tar.xz -C /tmp/libz && \
mv /tmp/libz/usr/lib/libz.so* /usr/glibc-compat/lib && \
apk del --purge .build-deps glibc-i18n && \
rm -rf /tmp/*.apk /tmp/gcc /tmp/gcc-libs.tar.xz /tmp/libz /tmp/libz.tar.xz /var/cache/apk/* && \
# end installing adoptopenjre && \
curl --fail --location --silent --show-error 'https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13.0.2%2B8/OpenJDK13U-jre_x64_linux_hotspot_13.0.2_8.tar.gz' --output /tmp/jre.tar.gz && \
mkdir -p /gocd-jre && \
tar -xf /tmp/jre.tar.gz -C /gocd-jre --strip 1 && \
rm -rf /tmp/jre.tar.gz && \
mkdir -p /go-agent /docker-entrypoint.d /go /godata
ADD docker-entrypoint.sh /
COPY --from=gocd-agent-unzip /go-agent /go-agent
# ensure that logs are printed to console output
COPY --chown=go:root agent-bootstrapper-logback-include.xml agent-launcher-logback-include.xml agent-logback-include.xml /go-agent/config/
RUN chown -R go:root /docker-entrypoint.d /go /godata /docker-entrypoint.sh \
&& chmod -R g=u /docker-entrypoint.d /go /godata /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
USER go