Merge pull request #579 from justincormack/vhdfix2

Use alpine to do raw2vhd
This commit is contained in:
Nathan LeClaire 2016-11-02 13:26:00 -07:00 committed by GitHub
commit 56e0bdad03
6 changed files with 15 additions and 23 deletions

View File

@ -5,9 +5,9 @@ IMAGE=alpine-base
default: push
hash:
hash: Dockerfile repositories
docker pull $(BASE)
tar cf - Dockerfile repositories | docker build --no-cache -t $(IMAGE):build -
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
docker run --rm $(IMAGE):build sha1sum /lib/apk/db/installed | sed 's/ .*//' > hash
push: hash

View File

@ -1,9 +1,11 @@
FROM alpine:3.4
COPY repositories /etc/apk/
RUN \
apk update && apk upgrade && \
apk add \
qemu-img \
qemu-system-arm \
qemu-system-x86_64 \
&& rm -rf /var/cache/apk/*
apk add --no-cache \
qemu-img@edge \
qemu-system-arm@edge \
qemu-system-x86_64@edge \
&& true

View File

@ -5,9 +5,9 @@ IMAGE=alpine-qemu
default: push
hash:
hash: Dockerfile repositories
docker pull $(BASE)
tar cf - Dockerfile | docker build --no-cache -t $(IMAGE):build -
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
docker run --rm $(IMAGE):build sha1sum /lib/apk/db/installed | sed 's/ .*//' > hash
push: hash

View File

@ -0,0 +1,2 @@
http://dl-cdn.alpinelinux.org/alpine/v3.4/main
@edge http://dl-cdn.alpinelinux.org/alpine/edge/main

View File

@ -1,17 +1,5 @@
FROM debian:jessie
FROM mobylinux/alpine-qemu:0e5f8a908e7976c3a6ab725b7267ab725e89c6ae
# Why bother with this whole song and dance? qemu-img versions >=2.2.1 have a
# "bug" which causes the generated VHD files to be improperly formatted for
# running on Azure: https://bugs.launchpad.net/qemu/+bug/1490611
#
# Since Alpine has only qemu-img >= 2.4.1 in its apk index, we cannot use
# Alpine.
RUN apt-get update && \
apt-get install -y qemu-utils
# If version changes in distributed packages, this build is busted. Sanity check.
RUN qemu-img --version
RUN qemu-img --version | awk '{ if ($3 != "2.1.2,") exit 1; }'
COPY ./cloud/azure/raw2vhd.sh /raw2vhd.sh
VOLUME ["/tmp"]

View File

@ -3,5 +3,5 @@
set -e
>&2 echo "Converting raw image file to VHD..."
qemu-img convert -f raw -O vpc -o subformat=fixed /tmp/mobylinux.img /tmp/mobylinux.vhd 1>&2
qemu-img convert -f raw -O vpc -o subformat=fixed,force_size /tmp/mobylinux.img /tmp/mobylinux.vhd 1>&2
>&2 echo "Done converting to VHD."