-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
host_vars/test-* | ||
roles/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Alpine Linux 3.4 via Docker on Ubuntu 16.04 Setup | ||
|
||
Add this to your ssh config: | ||
|
||
```text | ||
Host test-digitalocean-ubuntu1604_adocker_alpine34-x64-1 | ||
HostName 107.170.75.204 | ||
User root | ||
#IdentityFile nodejs_build_test | ||
``` | ||
|
||
..then run: | ||
|
||
```bash | ||
$ ansible-galaxy install -p . angstwad.docker_ubuntu | ||
$ ansible-playbook -i ../ansible-inventory ansible-playbook.yaml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
- hosts: test-ubuntu1604_docker_alpine34 | ||
remote_user: root | ||
gather_facts: False | ||
|
||
tasks: | ||
- name: Check for python | ||
raw: which python | ||
register: python_exists | ||
failed_when: python_exists.rc > 1 | ||
|
||
- name: Bootstrap for the apt package | ||
raw: apt install -y python-minimal aptitude | ||
tags: bootstrap | ||
when: python_exists.rc == 1 | ||
|
||
- hosts: test-ubuntu1604_docker_alpine34 | ||
remote_user: root | ||
gather_facts: True | ||
|
||
tasks: | ||
- include_vars: ansible-vars.yaml | ||
tags: vars | ||
|
||
- name: General | APT Update and upgrade | ||
apt: update_cache=yes upgrade=full | ||
tags: general | ||
|
||
- name: General | Install required packages | ||
apt: name={{ item }} update_cache=yes state=latest | ||
with_items: packages | ||
tags: general | ||
|
||
- name: User | Add {{ server_user }} user | ||
user: name="{{ server_user }}" shell=/bin/bash | ||
tags: user | ||
|
||
- name: User | Make work directories | ||
file: | ||
path: "/home/{{ server_user }}/{{ item }}" | ||
state: directory | ||
mode: 0755 | ||
owner: "{{ server_user }}" | ||
group: "{{ server_user }}" | ||
with_items: | ||
- build | ||
- tmp | ||
tags: user | ||
|
||
- name: Docker | Install Docker | ||
hosts: test-ubuntu1604_docker_alpine34 | ||
remote_user: root | ||
gather_facts: True | ||
roles: | ||
- angstwad.docker_ubuntu | ||
tags: docker | ||
|
||
- hosts: test-ubuntu1604_docker_alpine34 | ||
remote_user: root | ||
gather_facts: True | ||
|
||
tasks: | ||
- name: Docker | Generate Dockerfile | ||
template: src=./resources/Dockerfile.j2 dest=/root/Dockerfile | ||
tags: docker | ||
|
||
- name: Docker | Build Alpine image | ||
command: docker build -t node-ci:alpine-build /root/ | ||
|
||
- name: Init | Generate and copy init script | ||
template: src=./resources/jenkins.service.j2 dest=/lib/systemd/system/jenkins.service | ||
tags: init | ||
|
||
- name: Init | Start Jenkins | ||
service: name=jenkins state=started enabled=yes | ||
tags: init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
server_user: iojs | ||
packages: | ||
- curl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[defaults] | ||
roles_path = ./roles/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- src: angstwad.docker_ubuntu |
46 changes: 46 additions & 0 deletions
46
setup/ubuntu16.04_docker_alpine3.4/resources/Dockerfile.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
FROM alpine:3.4 | ||
|
||
ENV LC_ALL C | ||
ENV USER {{ server_user }} | ||
ENV JOBS {{ server_jobs | default(ansible_processor_vcpus) }} | ||
ENV HOME /home/{{ server_user }} | ||
ENV NODE_TEST_DIR /home/{{ server_user }}/tmp | ||
ENV PATH /usr/lib/ccache/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
ENV NODE_COMMON_PIPE /home/{{ server_user }}/test.pipe | ||
ENV OSTYPE linux-gnu | ||
ENV DESTCPU x64 | ||
ENV ARCH x64 | ||
|
||
RUN apk add --no-cache \ | ||
libstdc++ \ | ||
&& apk add --no-cache --virtual .build-deps \ | ||
binutils-gold \ | ||
curl \ | ||
g++ \ | ||
gcc \ | ||
gnupg \ | ||
libgcc \ | ||
linux-headers \ | ||
make \ | ||
paxctl \ | ||
python \ | ||
tar \ | ||
ccache \ | ||
openjdk8 \ | ||
git \ | ||
procps | ||
|
||
RUN addgroup -g 1000 {{ server_user }} | ||
|
||
RUN adduser -G {{ server_user }} -D -u 1000 {{ server_user }} | ||
|
||
VOLUME [ "/home/{{ server_user }}/" ] | ||
|
||
USER iojs | ||
|
||
CMD cd /home/iojs \ | ||
&& curl https://ci.nodejs.org/jnlpJars/slave.jar -O \ | ||
&& java \ | ||
-jar slave.jar \ | ||
-jnlpUrl https://ci.nodejs.org/computer/test-digitalocean-ubuntu1604_docker_alpine34-x64-1/slave-agent.jnlp \ | ||
-secret efbfadbf4807af0f1084a1e120ef5467b49432113661e11ce2ecc1ab71b96f38 |
16 changes: 16 additions & 0 deletions
16
setup/ubuntu16.04_docker_alpine3.4/resources/jenkins.service.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
Description=Jenkins Slave in Docker | ||
Wants=network.target | ||
After=network.target | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
|
||
[Service] | ||
Type=simple | ||
User=root | ||
ExecStart=/usr/bin/docker run --rm -v /home/{{ server_user }}:/home/{{ server_user }} --name node-ci-alpine node-ci:alpine-build | ||
ExecStop=/usr/bin/docker stop -t 5 node-ci-alpine | ||
Restart=always | ||
RestartSec=30 | ||
StartLimitInterval=0 |