forked from GoogleCloudPlatform/jenkins-packer-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
57 lines (49 loc) · 2.52 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
# Copyright 2015 Google Inc. All rights reserved.
#
# 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
#
# jenkins-packer-agent
#
# VERSION 0.0.1
FROM debian:jessie
MAINTAINER Evan Brown <[email protected]>
# Update/upgrade apt
RUN apt-get update -y && apt-get upgrade -y
# Install supervisord and Java
RUN apt-get install -y supervisor default-jre
VOLUME /var/log/supervisor
# Install Packer
RUN apt-get install -y unzip curl git
RUN curl -L https://dl.bintray.com/mitchellh/packer/packer_0.8.1_linux_amd64.zip -o /tmp/packer.zip; unzip /tmp/packer.zip -d /usr/local/bin
# Install Jenkins Swarm agent
ENV HOME /home/jenkins-agent
RUN useradd -c "Jenkins agent" -d $HOME -m jenkins-agent
RUN curl --create-dirs -sSLo \
/usr/share/jenkins/swarm-client-jar-with-dependencies.jar \
http://maven.jenkins-ci.org/content/repositories/releases/org/jenkins-ci/plugins/swarm-client/1.22/swarm-client-1.22-jar-with-dependencies.jar \
&& chmod 755 /usr/share/jenkins
# Install gcloud
ENV CLOUDSDK_PYTHON_SITEPACKAGES 1
RUN apt-get install -y -qq --no-install-recommends wget unzip python php5-mysql php5-cli php5-cgi openjdk-7-jre-headless openssh-client python-openssl \
&& apt-get clean \
&& cd /home/jenkins-agent \
&& wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.zip && unzip google-cloud-sdk.zip && rm google-cloud-sdk.zip \
&& google-cloud-sdk/install.sh --usage-reporting=true --path-update=true --bash-completion=true --rc-path=/.bashrc --disable-installation-options \
&& google-cloud-sdk/bin/gcloud --quiet components update pkg-go pkg-python pkg-java preview app \
&& google-cloud-sdk/bin/gcloud --quiet config set component_manager/disable_update_check true \
&& chown -R jenkins-agent /home/jenkins-agent/.config \
&& chown -R jenkins-agent google-cloud-sdk
ENV PATH /home/jenkins-agent/google-cloud-sdk/bin:$PATH
# Run Docker and Swarm processe with supervisord
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY jenkins-docker-supervisor.sh /usr/local/bin/jenkins-docker-supervisor.sh
ENTRYPOINT ["/usr/local/bin/jenkins-docker-supervisor.sh"]