Dockerfile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. FROM docker
  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. curl \
  8. git \
  9. subversion \
  10. openjdk7-jre-base \
  11. bash \
  12. && ln -fs /bin/bash /bin/sh
  13. # Installing Go agent
  14. WORKDIR /var/lib
  15. 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" \
  16. && unzip go-agent.zip \
  17. && mv go-agent-${GO_AGENT_VERSION} go-agent \
  18. && rm go-agent.zip
  19. RUN rm -rf /tmp/* /var/tmp/* /var/cache/apk/*
  20. RUN git config --global url."https://".insteadOf git://
  21. #VOLUME ["/var/lib/go-agent", "/var/log/go-agent", "/var/go/.ssh"]
  22. COPY autoregister.properties /var/lib/go-agent/config/autoregister.properties
  23. #ENTRYPOINT ["/bin/bash", "-c"]
  24. CMD until curl -s -o /dev/null "http://${GO_SERVER}:${GO_SERVER_PORT}"; do sleep 5; done; \
  25. if [ -n "$AGENT_KEY" ]; then \
  26. sed -i -e 's/=.*/=/g' -e "s/key=/key=$AGENT_KEY/" -e "s/resources=/resources=$AGENT_RESOURCES/" /var/lib/go-agent/config/autoregister.properties; \
  27. fi; \
  28. (/var/lib/go-agent/agent.sh &); (/usr/local/bin/docker daemon -p /var/run/docker-ssd.pid &);while [ ! -f /var/lib/go-agent/go-agent-bootstrapper.log ]; do sleep 1; done; exec tail -F /var/lib/go-agent/*.log