Dockerfile 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. FROM docker
  2. ENV JAVA_HOME="/usr/lib/jvm/default-jvm"
  3. RUN apk update \
  4. && apk add --no-cache \
  5. curl \
  6. git \
  7. subversion \
  8. openjdk7-jre-base \
  9. bash \
  10. && ln -fs /bin/bash /bin/sh
  11. # Installing Go agent
  12. WORKDIR /var/lib
  13. RUN curl -sL -o go-agent-16.1.0.zip "https://download.go.cd/binaries/16.1.0-2855/generic/go-agent-16.1.0-2855.zip" \
  14. && unzip go-agent-16.1.0.zip \
  15. && mv go-agent-16.1.0 go-agent \
  16. && rm go-agent-16.1.0.zip
  17. RUN rm -rf /tmp/* /var/tmp/* /var/cache/apk/*
  18. RUN git config --global url."https://".insteadOf git://
  19. #VOLUME ["/var/lib/go-agent", "/var/log/go-agent", "/var/go/.ssh"]
  20. COPY autoregister.properties /var/lib/go-agent/config/autoregister.properties
  21. #ENTRYPOINT ["/bin/bash", "-c"]
  22. CMD until curl -s -o /dev/null "http://${GO_SERVER}:${GO_SERVER_PORT}"; do sleep 5; done; \
  23. if [ -n "$AGENT_KEY" ]; then \
  24. sed -i -e 's/=.*/=/g' -e "s/key=/key=$AGENT_KEY/" -e "s/resources=/resources=$AGENT_RESOURCES/" /var/lib/go-agent/config/autoregister.properties; \
  25. fi; \
  26. (/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