Skip to content

Commit 89afecf

Browse files
committed
Merge pull request #1 from QuentinPerez/1.4
bump 1.4
2 parents 8512d7e + e4d107d commit 89afecf

File tree

11 files changed

+192
-135
lines changed

11 files changed

+192
-135
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.docker-container-*
2+
/docker-rules.mk
3+
/.overlays

Dockerfile

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
## -*- docker-image-name: "armbuild/scw-image-builder:latest" -*-
2-
FROM scaleway/docker:1.9.0
1+
FROM scaleway/docker:amd64-1.10
2+
# following 'FROM' lines are used dynamically thanks do the image-builder
3+
# which dynamically update the Dockerfile if needed.
4+
#FROM scaleway/docker:armhf-1.10 # arch=armv7l
5+
#FROM scaleway/docker:arm64-1.10 # arch=arm64
6+
#FROM scaleway/docker:i386-1.10 # arch=i386
7+
#FROM scaleway/docker:mips-1.10 # arch=mips
8+
39
MAINTAINER Scaleway <opensource@scaleway.com> (@scaleway)
410

511

@@ -18,14 +24,25 @@ RUN apt-get -qq update \
1824
&& apt-get clean
1925

2026
# Download scw
21-
ENV SCW_VERSION 1.5.0
22-
RUN curl -L https://github.com/scaleway/scaleway-cli/releases/download/v${SCW_VERSION}/scw_${SCW_VERSION}_armhf.deb > scw.deb \
23-
&& dpkg -i scw.deb \
27+
ENV SCW_VERSION 1.8.0
28+
29+
RUN case "${ARCH}" in \
30+
armv7l|armhf|arm) \
31+
curl -L https://github.com/scaleway/scaleway-cli/releases/download/v${SCW_VERSION}/scw_${SCW_VERSION}_armhf.deb > scw.deb \
32+
;; \
33+
amd64|x86_64|i386) \
34+
curl -L https://github.com/scaleway/scaleway-cli/releases/download/v${SCW_VERSION}/scw_${SCW_VERSION}_amd64.deb > scw.deb \
35+
;; \
36+
*) \
37+
echo "Unhandled architecture: ${ARCH}."; exit 1; \
38+
;; \
39+
esac
40+
41+
RUN dpkg -i scw.deb \
2442
&& rm scw.deb
2543

2644
# Patch rootfs
27-
ADD ./patches/etc/ /etc/
28-
ADD ./patches/usr/ /usr/
45+
ADD ./overlay/ /
2946

3047
# Clean rootfs from image-builder
3148
RUN /usr/local/sbin/builder-leave

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
DOCKER_NAMESPACE = armbuild/
2-
NAME = scw-image-builder
1+
NAME = image-builder
32
VERSION = latest
4-
VERSION_ALIASES = 1.3.0 1.3 1
3+
VERSION_ALIASES = 1.4.0 1.4 1
54
TITLE = image-builder
65
DESCRIPTION = An image to build other images
7-
SOURCE_URL = https://github.com/scaleway/image-tools/tree/master/image-builder
6+
SOURCE_URL = https://github.com/scaleway/image-builder
7+
88

99
IMAGE_VOLUME_SIZE = 150G
1010
IMAGE_BOOTSCRIPT = docker
11-
IMAGE_NAME = Image Builder 1.3
11+
IMAGE_NAME = Image Builder 1.4
12+
13+
DEFAULT_IMAGE_ARCH = x86_64
1214

1315
## Image tools (https://github.com/scaleway/image-tools)
1416
all: docker-rules.mk

README.md

Lines changed: 106 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -7,135 +7,128 @@ Scripts to build the official Image Builder on Scaleway
77
![](http://s10.postimg.org/fw962sxkp/builder.png)
88
---
99

10-
**This image is meant to be used on a C1 server.**
10+
**This image is meant to be used on a Scaleway server.**
1111

12-
We use the Docker's building system and convert it at the end to a disk image that will boot on real servers without Docker. Note that the image is still runnable as a Docker container for debug or for inheritance.
12+
We use the Docker's building system and convert it at the end to a disk image that will boot on real servers without Docker.
13+
14+
> Note that the image is still runnable as a Docker container for debug or for inheritance.
1315
1416
[More info](https://github.com/scaleway/image-tools)
1517

1618

1719
## How to build a custom image using [scw](https://github.com/scaleway/scaleway-cli)
1820

1921
**My custom image's description**
20-
- based on the official [Ubuntu Vivid](https://github.com/scaleway/image-ubuntu)
22+
- based on the official [Ubuntu Wily](https://github.com/scaleway/image-ubuntu)
2123
- with `cowsay` pre-installed
2224

2325
---
2426

2527
##### 1. Making the environment
2628

2729
```console
28-
root@yourmachine> scw run --name="buildcowsay" builder
29-
Welcome to the image to build other images on Scaleway' C1.
30-
31-
* Kernel: GNU/Linux 4.0.5-235 armv7l
32-
* Distribution: An image to build other images (2015-08-06) on Ubuntu 15.04
33-
* Internal ip: X.X.X.X
34-
* External ip: X.X.X.X
35-
* Disk /dev/nbd0: buildcowsay-scw-image-builder-1.0-2015-08-06_15:20 (l_ssd 50G)
36-
* Uptime: 19:44:48 up 1 min, 0 users, load average: 0.44, 0.13, 0.05
37-
38-
Links
39-
* Documentation: https://scaleway.com/docs
40-
* Community: https://community.scaleway.com
41-
* Image source: https://github.com/scaleway/image-tools/tree/master/image-builder
42-
43-
Docker 1.7.1 is running using the 'aufs' storage driver.
44-
Installed tools: docker-compose, nsenter, gosu and pipework are installed.
45-
Getting started with Docker on C1: https://community.cloud.online.net/t/383?u=manfred.
30+
root@yourmachine> scw run --name="buildcowsay" image-builder
31+
_
32+
___ ___ __ _| | _____ ____ _ _ _
33+
/ __|/ __/ _` | |/ _ \ \ /\ / / _` | | | |
34+
\__ \ (_| (_| | | __/\ V V / (_| | |_| |
35+
|___/\___\__,_|_|\___| \_/\_/ \__,_|\__, |
36+
|___/
37+
...
4638

4739
*****************************************************************************
4840

4941
Welcome on the image-builder.
50-
Here, you will be able to craft your own images.
42+
Here, you'll be able to craft your own images.
5143

52-
To configure your environment please run:
44+
To configure your environment run:
5345

5446
$> image-builder-configure
5547

5648
*****************************************************************************
5749

58-
The programs included with the Ubuntu system are free software;
59-
the exact distribution terms for each program are described in the
60-
individual files in /usr/share/doc/*/copyright.
61-
62-
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
63-
applicable law.
50+
...
6451

65-
root@buildcowsay> image-builder-configure
52+
root@buildcowsay:~# image-builder-configure
6653
Login (cloud.scaleway.com): # yourmail
6754
Password: # yourpassword
68-
root@buildcowsay> mkdir vivid-cowsay
69-
root@buildcowsay> cp Makefile vivid-cowsay
70-
root@buildcowsay> cd vivid-cowsay
71-
root@buildcowsay> touch Dockerfile
72-
root@buildcowsay> ls -l
55+
root@buildcowsay:~# mkdir cowsay
56+
root@buildcowsay:~# cp Makefile.sample cowsay/Makefile
57+
root@buildcowsay:~# cp Dockerfile.sample cowsay/Dockerfile
58+
root@buildcowsay:~# cd cowsay
59+
root@buildcowsay:~/cowsay# ls -l
7360
total 4
74-
-rw-r--r-- 1 root root 0 Aug 28 15:35 Dockerfile
75-
-rw-r--r-- 1 root root 146 Aug 28 15:19 Makefile
61+
-rw-r--r-- 1 root root 562 Mar 18 10:37 Dockerfile
62+
-rw-r--r-- 1 root root 556 Mar 18 10:38 Makefile
7663
```
7764
##### 2. Configuring your Makefile
7865
```console
79-
root@buildcowsay> cat Makefile
80-
NAME = YOUR_NAME
81-
VERSION = latest
82-
VERSION_ALIASES =
83-
TITLE = YOUR_TITLE
84-
SOURCE_URL = https://github/com/...
66+
NAME = cowsay
67+
VERSION = latest
68+
VERSION_ALIASES = 1.2.3 1.2 1
69+
TITLE = wily-cowsay
70+
DESCRIPTION = wily with cowsay pre-installed
71+
DOC_URL =
72+
SOURCE_URL = https://github.com/scaleway-community/...
8573
VENDOR_URL =
74+
DEFAULT_IMAGE_ARCH = x86_64
75+
8676

87-
IMAGE_VOLUME_SIZE = 50G
88-
IMAGE_BOOTSCRIPT = stable
89-
IMAGE_NAME = YOUR_IMAGE_NAME
77+
IMAGE_VOLUME_SIZE = 50G
78+
IMAGE_BOOTSCRIPT = stable
79+
IMAGE_NAME = cowsay
9080

91-
all: docker-rules.mk
81+
## Image tools (https://github.com/scaleway/image-tools)
82+
all: docker-rules.mk
9283
docker-rules.mk:
93-
wget -qO - http://j.mp/scw-builder | bash
84+
wget -qO - http://j.mp/scw-builder | bash
9485
-include docker-rules.mk
9586
```
9687

9788

98-
##### 3. Generating a Dockerfile
89+
##### 3. Configuring your Dockerfile
90+
91+
> Note: Don't remove the comments #FROM scaleway/distribution:arch-version # arch=arch
92+
93+
> These lines are used by Makefile to handle the multiarch
9994
100-
**Copy-Paste** this in your `Dockerfile` [see more](https://docs.docker.com/reference/builder/)
10195
```dockerfile
102-
# base image - ubuntu:vivid
103-
FROM armbuild/scw-distrib-ubuntu:vivid
96+
FROM scaleway/ubuntu:amd64-wily
97+
# following 'FROM' lines are used dynamically thanks do the image-builder
98+
# which dynamically update the Dockerfile if needed.
99+
#FROM scaleway/ubuntu:armhf-wily # arch=armv7l
100+
#FROM scaleway/ubuntu:arm64-wily # arch=arm64
101+
#FROM scaleway/ubuntu:i386-wily # arch=i386
102+
#FROM scaleway/ubuntu:mips-wily # arch=mips
103+
104+
# Prepare rootfs
105+
RUN /usr/local/sbin/scw-builder-enter
104106

105107
# install cowsay
106108
RUN apt-get install -y cowsay
109+
110+
# Clean rootfs
111+
RUN /usr/local/sbin/scw-builder-leave
107112
```
113+
108114
You can see other Dockerfiles [here](https://github.com/scaleway/image-tools#official-images-built-with-image-tools)
109115

110116
##### 4. Building the custom image
111117
```console
112118
root@buildcowsay> make image_on_local
113-
make[1]: Entering directory '/root/vivid-cowsay'
114-
test -f /tmp/create-image-from-http.sh \
115-
|| wget -qO /tmp/create-image-from-http.sh https://github.com/scaleway/scaleway-cli/raw/master/examples/create-image-from-http.sh
116-
chmod +x /tmp/create-image-from-http.sh
117-
VOLUME_SIZE=50G /tmp/create-image-from-http.sh http://YOURIP/vivid-cowsay-latest/rootfs.tar
118-
[+] URL of the tarball: http://YOURIP/vivid-cowsay-latest/rootfs.tar
119-
[+] Target name: vivid-cowsay-latest-2015-08-28_20:22
119+
...
120+
[+] URL of the tarball: http://YOUR_IP:8000/x86_64-cowsay-latest/x86_64-cowsay-latest.tar
121+
[+] Target name: x86_64-cowsay-latest.tar
120122
[+] Creating new server in rescue mode with a secondary volume...
121-
[+] Server created: 53f65ff4-8a37-495c-9539-460f7c6facf3
123+
[+] Server created: 3e801785-4e62-425f-bb5a-04eac555ff79
122124
[+] Booting...
123-
Linux image-writer-vivid-cowsay-latest-2015-08-28-20-22 3.2.34-30 #17 SMP Mon Apr 13 15:53:45 UTC 2015 armv7l armv7l armv7l GNU/Linux
125+
Linux vm-10-2-12-155 4.4.4-std-3 #1 SMP Tue Mar 8 17:31:34 UTC 2016 x86_64 GNU/Linux
124126
[+] Server is booted
125-
[+] Formating and mounting /dev/nbd1...
126-
mke2fs 1.42.9 (4-Feb-2014)
127-
Filesystem label=
128-
OS type: Linux
129-
Block size=4096 (log=2)
130-
Fragment size=4096 (log=2)
131-
Stride=0 blocks, Stripe width=0 blocks
132-
3055616 inodes, 12207031 blocks
133-
610351 blocks (5.00%) reserved for the super user
134-
First data block=0
135-
Maximum filesystem blocks=0
136-
373 block groups
137-
32768 blocks per group, 32768 fragments per group
138-
8192 inodes per group
127+
[+] Formating and mounting disk...
128+
mke2fs 1.42.12 (29-Aug-2014)
129+
ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /dev/vda is mounted.
130+
Creating filesystem with 12207031 4k blocks and 3055616 inodes
131+
Filesystem UUID: 0201e6cd-4848-4118-b762-297968e776af
139132
Superblock backups stored on blocks:
140133
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
141134
4096000, 7962624, 11239424
@@ -146,25 +139,33 @@ Creating journal (32768 blocks): done
146139
Writing superblocks and filesystem accounting information: done
147140

148141
[+] /dev/nbd1 formatted in ext4 and mounted on /mnt
149-
[+] Download tarball and write it to /dev/nbd1
150-
[+] Tarball extracted on /dev/nbd1
142+
[+] Download tarball and write it to /mnt
143+
[+] Tarball extracted on disk
151144
[+] Stopping the server
152145
[+] Server stopped
153-
[+] Creating a snapshot of nbd1
154-
[+] Snapshot 704cf25a-4641-424d-9c28-1f805f5d6259 created
146+
[+] Creating a snapshot of disk 1
147+
[+] Snapshot ae6f1ed9-6b77-46f9-861a-2b4d66cb38b5 created
155148
[+] Creating an image based of the snapshot
156-
[+] Image created: 8eef9fff-f53b-4798-9fd7-54944e1cf998 # YOUR_IMAGE_ID
149+
[+] Image created: 53962798-2933-4cc9-b6c9-1e05f6ff7051 # IMAGE_ID
157150
[+] Deleting temporary server
158151
[+] Server deleted
159152
```
160153
Your custom image is now available [here](https://cloud.scaleway.com/#/images)
161154

162155
##### 4. Running your custom image
163156
```console
164-
root@buildcowsay> scw run --tmp-ssh-key YOUR_IMAGE_ID
165-
root@your_custom_image> cowsay "Hello from my custom vivid"
157+
root@buildcowsay:~/cowsay# scw run --tmp-ssh-key --name="cowsay-app" IMAGE_ID
158+
_
159+
___ ___ __ _| | _____ ____ _ _ _
160+
/ __|/ __/ _` | |/ _ \ \ /\ / / _` | | | |
161+
\__ \ (_| (_| | | __/\ V V / (_| | |_| |
162+
|___/\___\__,_|_|\___| \_/\_/ \__,_|\__, |
163+
|___/
164+
...
165+
166+
root@cowsay-app:~# cowsay "Hello from my app"
166167
____________________________
167-
< Hello from my custom vivid >
168+
< Hello from my app >
168169
----------------------------
169170
\ ^__^
170171
\ (oo)\_______
@@ -175,9 +176,31 @@ root@your_custom_image> cowsay "Hello from my custom vivid"
175176

176177
---
177178

179+
## Multiarch
180+
181+
By default `make image_on_local` use your architecture (x86_64 on C2/VPS and armv7l on C1), if you want to craft your image in arm you must specify the architecture with `armv7l`
182+
183+
```console
184+
# works only on C2/VPS
185+
ARCH=armv7l make image_on_local
186+
```
187+
188+
Or run image-builder with C1
189+
190+
```console
191+
root@yourmachine> scw run --name="arm-builder" --commercial-type=C1 image-builder
192+
```
193+
194+
195+
## Know issues
196+
197+
- if you have an error when you try to connect on your Scaleway account, remove `~/.scwrc` and retry
198+
178199
## Changelog
179200

180201
### Unreleased
202+
* Multiarch documentation
203+
* Bump scw to 1.8.0
181204
* Improved image-builder-configure (now he don't ask for login/password is ~/.scwrc already exist)
182205

183206
### 1.3.0 (2015-09-11)

patches/etc/update-motd.d/70-builder renamed to overlay/etc/update-motd.d/70-builder

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test -f ~/.s3cfg && test -f ~/.scwrc || cat << EOF
88
Welcome on the image-builder.
99
Here, you'll be able to craft your own images.
1010
11-
To configure your environment please run:
11+
To configure your environment run:
1212
1313
$> image-builder-configure
1414

overlay/root/Dockerfile.sample

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM scaleway/ubuntu:amd64-wily
2+
# following 'FROM' lines are used dynamically thanks do the image-builder
3+
# which dynamically update the Dockerfile if needed.
4+
#FROM scaleway/ubuntu:armhf-wily # arch=armv7l
5+
#FROM scaleway/ubuntu:arm64-wily # arch=arm64
6+
#FROM scaleway/ubuntu:i386-wily # arch=i386
7+
#FROM scaleway/ubuntu:mips-wily # arch=mips
8+
9+
# Prepare rootfs
10+
RUN /usr/local/sbin/scw-builder-enter
11+
12+
# Add your commands here (before scw-builder-leave and after scw-builder-enter)
13+
14+
# Clean rootfs
15+
RUN /usr/local/sbin/scw-builder-leave

overlay/root/Makefile.sample

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
NAME = my-image
2+
VERSION = latest
3+
VERSION_ALIASES = 1.2.3 1.2 1
4+
TITLE = My image
5+
DESCRIPTION = My image with Ubuntu and MySQL
6+
DOC_URL =
7+
SOURCE_URL = https://github.com/scaleway-community/...
8+
VENDOR_URL =
9+
DEFAULT_IMAGE_ARCH = x86_64
10+
11+
12+
IMAGE_VOLUME_SIZE = 50G
13+
IMAGE_BOOTSCRIPT = stable
14+
IMAGE_NAME = My image
15+
16+
## Image tools (https://github.com/scaleway/image-tools)
17+
all: docker-rules.mk
18+
docker-rules.mk:
19+
wget -qO - http://j.mp/scw-builder | bash
20+
-include docker-rules.mk

0 commit comments

Comments
 (0)