Skip to content

Commit 9f208d1

Browse files
author
Sergei Antipov
committed
Build Ubuntu 12.04 image insteed of pull it
1 parent 0ea31ad commit 9f208d1

File tree

2 files changed

+61
-3
lines changed

2 files changed

+61
-3
lines changed

.travis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,18 @@ before_install:
4444
- sudo apt-get update
4545
- sudo apt-get install ansible python-pip -y
4646
- sudo pip install docker-py==1.5.0
47-
# Pull docker image
48-
- sudo docker pull ${DISTRIBUTION}:${DIST_VERSION}
47+
# Pull docker image or build it
48+
- >
49+
if [ -f tests/Dockerfile.${DISTRIBUTION}_${DIST_VERSION} ]; then
50+
sudo docker build --rm=true --file=tests/Dockerfile.${DISTRIBUTION}_${DIST_VERSION}
51+
--tag ${DISTRIBUTION}:${DIST_VERSION} tests; else sudo docker pull ${DISTRIBUTION}:${DIST_VERSION}; fi
4952
- sudo ln -s ${PWD} /etc/ansible/roles/greendayonfire.mongodb
5053

5154
script:
5255
# Test 1
53-
- sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_version=${MONGODB_VERSION}
56+
- >
57+
sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_version=${MONGODB_VERSION}
58+
-e image_name=${DISTRIBUTION}:${DIST_VERSION}
5459
# Idempotence test
5560
- >
5661
sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_version=${MONGODB_VERSION}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM ubuntu:12.04
2+
3+
# much of this was gleaned from https://github.com/lxc/lxc/blob/lxc-0.8.0/templates/lxc-ubuntu.in
4+
# and then heavily modified and hacked like crazy
5+
6+
# we're going to want this bad boy installed so we can connect :)
7+
RUN apt-get update && apt-get install -y ssh python
8+
9+
ADD init-fake.conf /etc/init/fake-container-events.conf
10+
11+
# undo some leet hax of the base image
12+
RUN rm /usr/sbin/policy-rc.d; \
13+
rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl
14+
15+
# generate a nice UTF-8 locale for our use
16+
RUN locale-gen en_US.UTF-8 && update-locale LANG=en_US.UTF-8
17+
18+
# remove some pointless services
19+
RUN /usr/sbin/update-rc.d -f ondemand remove; \
20+
for f in \
21+
/etc/init/u*.conf \
22+
/etc/init/mounted-dev.conf \
23+
/etc/init/mounted-proc.conf \
24+
/etc/init/mounted-run.conf \
25+
/etc/init/mounted-tmp.conf \
26+
/etc/init/mounted-var.conf \
27+
/etc/init/hostname.conf \
28+
/etc/init/networking.conf \
29+
/etc/init/tty*.conf \
30+
/etc/init/plymouth*.conf \
31+
/etc/init/hwclock*.conf \
32+
/etc/init/module*.conf\
33+
; do \
34+
dpkg-divert --local --rename --add "$f"; \
35+
done; \
36+
echo '# /lib/init/fstab: cleared out for bare-bones Docker' > /lib/init/fstab
37+
38+
# small fix for SSH in 13.10 (that's harmless everywhere else)
39+
RUN sed -ri 's/^session\s+required\s+pam_loginuid.so$/session optional pam_loginuid.so/' /etc/pam.d/sshd
40+
41+
RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
42+
43+
# let Upstart know it's in a container
44+
ENV container docker
45+
46+
# set a cheap, simple password for great convenience
47+
RUN echo 'root:docker.io' | chpasswd
48+
49+
# we can has SSH
50+
EXPOSE 22
51+
52+
# pepare for takeoff
53+
CMD ["/sbin/init"]

0 commit comments

Comments
 (0)