Commit 5458bbd9 by Brian Beggs

Updated go-agent dockerfile to override start script so container process…

Updated go-agent dockerfile to override start script so container process captures the correct GO_SERVER_PORT
parent f8f10733
*
!playbooks/
!docker/build/*/ansible_overrides.yml
!docker/build/*/*.sh
!docker/build/*
docker/build/*/Dockerfile
!docker/plays/
!util/install/
# Build using: docker build -f Dockerfile.gocd-agent -t gocd-agent .
# FROM edxops/precise-common:latest
FROM gocd/gocd-agent:16.2.1
LABEL version="0.01" \
LABEL version="0.02" \
description="This custom go-agent docker file installs additional requirements for the edx pipeline"
RUN \
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
add-apt-repository -y ppa:webupd8team/java && \
apt-get update && \
apt-get install -y oracle-java7-installer && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/oracle-jdk7-installer
# Define working directory.
WORKDIR /data
# Define commonly used JAVA_HOME variable
ENV JAVA_HOME /usr/lib/jvm/java-7-oracle
RUN apt-get update && apt-get install -y -q \
python \
......@@ -15,4 +28,8 @@ RUN apt-get update && apt-get install -y -q \
# TODO: repalce this with a pip install command so we can version this properly
RUN git clone https://github.com/edx/tubular.git /opt/tubular
RUN pip install -r /opt/tubular/requirements.txt
RUN cd /opt/tubular;python setup.py install
\ No newline at end of file
RUN cd /opt/tubular;python setup.py install
ADD docker/build/go-agent/files/go-agent-start.sh /etc/service/go-agent/run
ADD docker/build/go-agent/files/go-agent-env-vars /etc/default/go-agent
RUN update-java-alternatives -s java-7-oracle
......@@ -34,8 +34,8 @@ necessary.
* Log docker in to AWS
- ```sh -c `aws ecr get-login --region us-east-1` ```
* Tag image
- ```docker tag -f <image_id> 372153017832.dkr.ecr.us-east-1.amazonaws.com/release-pipeline:latest```
- ```docker tag -f <image_id> 372153017832.dkr.ecr.us-east-1.amazonaws.com/release-pipeline:<version_number>```
- ```docker tag -f <image_id> ############.dkr.ecr.us-east-1.amazonaws.com/release-pipeline:latest```
- ```docker tag -f <image_id> ############.dkr.ecr.us-east-1.amazonaws.com/release-pipeline:<version_number>```
* upload:
- ```docker push 372153017832.dkr.ecr.us-east-1.amazonaws.com/edx/release-pipeline/go-agent/python:latest```
- ```docker push 372153017832.dkr.ecr.us-east-1.amazonaws.com/edx/release-pipeline/go-agent/python:<version_number>```
\ No newline at end of file
- ```docker push ############.dkr.ecr.us-east-1.amazonaws.com/edx/release-pipeline/go-agent/python:latest```
- ```docker push ############.dkr.ecr.us-east-1.amazonaws.com/edx/release-pipeline/go-agent/python:<version_number>```
\ No newline at end of file
GO_SERVER=127.0.0.1
export GO_SERVER
GO_SERVER_PORT=8153
export GO_SERVER_PORT
GO_SERVER_SSL_PORT=8154
export GO_SERVER_SSL_PORT
AGENT_WORK_DIR=/var/lib/${SERVICE_NAME:-go-agent}
export AGENT_WORK_DIR
DAEMON=N
VNC=N
export JAVA_HOME="/usr/lib/jvm/java-7-oracle/jre" # SET_BY_GO_INSTALLER__DONT_REMOVE
\ No newline at end of file
#!/bin/bash
GO_SERVER=${GO_SERVER:-go-server}
GO_SERVER_PORT=${GO_SERVER_PORT:-go-server-port}
COLOR_START=""
COLOR_END=""
echo -e "${COLOR_START}Starting Go Agent to connect to server $GO_SERVER:$GO_SERVER_PORT ...${COLOR_END}"
sed -i -e 's/GO_SERVER=.*/GO_SERVER='$GO_SERVER'/' /etc/default/go-agent
sed -i -e 's/GO_SERVER_PORT=.*/GO_SERVER_PORT='$GO_SERVER_PORT'/' /etc/default/go-agent
sed -i -e 's/GO_SERVER_SSL_PORT=.*/GO_SERVER_SSL_PORT='$GO_SERVER_SSL_PORT'/' /etc/default/go-agent
mkdir -p /var/lib/go-agent/config
/bin/rm -f /var/lib/go-agent/config/autoregister.properties
AGENT_KEY="${AGENT_KEY:-123456789abcdef}"
echo "agent.auto.register.key=$AGENT_KEY" >/var/lib/go-agent/config/autoregister.properties
if [ -n "$AGENT_RESOURCES" ]; then echo "agent.auto.register.resources=$AGENT_RESOURCES" >>/var/lib/go-agent/config/autoregister.properties; fi
if [ -n "$AGENT_ENVIRONMENTS" ]; then echo "agent.auto.register.environments=$AGENT_ENVIRONMENTS" >>/var/lib/go-agent/config/autoregister.properties; fi
/sbin/setuser go /etc/init.d/go-agent start
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment