1
0

Dockerfile 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. FROM alpine
  2. ARG GO_AGENT_VERSION=16.1.0
  3. ARG GO_AGENT_BUILD=2855
  4. ENV JAVA_HOME="/usr/lib/jvm/default-jvm"
  5. RUN apk update \
  6. && apk add --no-cache \
  7. libc6-compat \
  8. curl \
  9. git \
  10. subversion \
  11. openjdk7-jre-base \
  12. bash \
  13. && ln -fs /bin/bash /bin/sh
  14. # Installing CloudFoundry
  15. RUN cd /usr/local/bin \
  16. && curl -sL "https://cli.run.pivotal.io/stable?release=linux64-binary&source=github" | tar -zx \
  17. && mkdir /lib64 \
  18. && ln -s /lib/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 \
  19. && cf add-plugin-repo bluemix-cf-staging http://plugins.ng.bluemix.net >/dev/null 2>&1
  20. # Installing Go agent
  21. WORKDIR /var/lib
  22. RUN curl -sL -o go-agent.zip "https://download.go.cd/binaries/${GO_AGENT_VERSION}-${GO_AGENT_BUILD}/generic/go-agent-${GO_AGENT_VERSION}-${GO_AGENT_BUILD}.zip" \
  23. && unzip go-agent.zip \
  24. && mv go-agent-${GO_AGENT_VERSION} go-agent \
  25. && rm go-agent.zip
  26. RUN git config --global url."https://".insteadOf git://
  27. RUN rm -rf /tmp/* /var/tmp/* /var/cache/apk/*
  28. #VOLUME ["/var/lib/go-agent", "/var/log/go-agent", "/var/go/.ssh"]
  29. COPY autoregister.properties /var/lib/go-agent/config/autoregister.properties
  30. #ENTRYPOINT ["/bin/bash", "-c"]
  31. CMD until curl -s -o /dev/null "http://${GO_SERVER}:${GO_SERVER_PORT}"; do sleep 5; done; \
  32. if [ -n "$AGENT_KEY" ]; then \
  33. sed -i -e 's/=.*/=/g' -e "s/key=/key=$AGENT_KEY/" -e "s/resources=/resources=$AGENT_RESOURCES/" /var/lib/go-agent/config/autoregister.properties; \
  34. fi; \
  35. (/var/lib/go-agent/agent.sh &); while [ ! -f /var/lib/go-agent/go-agent-bootstrapper.log ]; do sleep 1; done; exec tail -F /var/lib/go-agent/*.log