Skip to content

Commit

Permalink
Build with general user
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsushid committed Apr 8, 2017
1 parent 5a53858 commit a55adec
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 56 deletions.
24 changes: 16 additions & 8 deletions Dockerfile.debian8
Expand Up @@ -27,21 +27,29 @@ RUN echo "deb http://httpredir.debian.org/debian jessie-backports main" > /etc/a
ruby \
ruby-dev \
starlet \
sudo \
&& apt-get install -y --no-install-recommends -t jessie-backports \
libuv1-dev \
&& : install newer Path::Tiny Perl module to avoid a test error \
&& cd /tmp \
&& curl -SLO "http://ftp.debian.org/debian/pool/main/libp/libpath-tiny-perl/$PATH_TINY_PERL" \
&& dpkg -i "$PATH_TINY_PERL"
COPY src/v${PKGVER}.tar.gz /tmp/
RUN mkdir -p /tmp/h2o/h2o-${PKGVER} \
&& cd /tmp/h2o/h2o-${PKGVER} \
&& tar xzf /tmp/v${PKGVER}.tar.gz --strip-components=1 \
RUN useradd -ms /bin/bash builder \
&& echo "builder ALL=NOPASSWD: ALL" > /etc/sudoers.d/builder \
&& chmod 440 /etc/sudoers.d/builder
ENV HOME=/home/builder
USER builder
COPY src/v${PKGVER}.tar.gz $HOME/
RUN mkdir -p $HOME/h2o/h2o-${PKGVER} \
&& cd $HOME/h2o/h2o-${PKGVER} \
&& tar xzf $HOME/v${PKGVER}.tar.gz --strip-components=1 \
&& tar cJf ../h2o_${PKGVER}.orig.tar.xz .
ADD src/debian/ /tmp/h2o/h2o-${PKGVER}/debian/
RUN cd /tmp/h2o/h2o-${PKGVER} \
ADD src/debian/ $HOME/h2o/h2o-${PKGVER}/debian/
RUN cd $HOME/h2o/h2o-${PKGVER} \
&& sudo chown -R builder:builder debian \
&& mv -f debian/changelog.debian8 debian/changelog \
&& rm -f debian/changelog.* \
&& rm -f debian/changelog.*
RUN cd $HOME/h2o/h2o-${PKGVER} \
&& dpkg-buildpackage -us -uc \
&& tar -czf /tmp/h2o.tar.gz -C /tmp/h2o --exclude=./h2o-${PKGVER} .
&& tar -czf /tmp/h2o.tar.gz -C $HOME/h2o --exclude=./h2o-${PKGVER} .
CMD ["/bin/true"]
31 changes: 20 additions & 11 deletions Dockerfile.ubuntu1404
Expand Up @@ -30,26 +30,35 @@ RUN apt-get update \
ruby \
ruby-dev \
starlet \
sudo \
&& : install newer Path::Tiny Perl module to avoid a test error \
&& cd /tmp \
&& curl -SLO "http://archive.ubuntu.com/ubuntu/pool/main/libp/libpath-tiny-perl/$PATH_TINY_PERL" \
&& dpkg -i "$PATH_TINY_PERL"
ADD ./deps /tmp/deps
RUN cd /tmp/deps \
RUN useradd -ms /bin/bash builder \
&& echo "builder ALL=NOPASSWD: ALL" > /etc/sudoers.d/builder \
&& chmod 440 /etc/sudoers.d/builder
ENV HOME=/home/builder
USER builder
ADD ./deps $HOME/deps
RUN sudo chown -R builder:builder $HOME/deps \
&& cd $HOME/deps \
&& LIBUV_VERSION="$(ls libuv1_*.orig.tar.gz | sed -e 's/libuv1_\(.*\)\.orig\.tar\.gz/\1/' | sort -r | head -n1)" \
&& dpkg-source -x libuv1_${LIBUV_VERSION}*.dsc \
&& cd libuv1-${LIBUV_VERSION} \
&& dpkg-buildpackage -us -uc \
&& dpkg -i ../libuv1-dev_${LIBUV_VERSION}*.deb ../libuv1_${LIBUV_VERSION}*.deb
COPY src/v${PKGVER}.tar.gz /tmp/
RUN mkdir -p /tmp/h2o/h2o-${PKGVER} \
&& cd /tmp/h2o/h2o-${PKGVER} \
&& tar xzf /tmp/v${PKGVER}.tar.gz --strip-components=1 \
&& sudo dpkg -i ../libuv1-dev_${LIBUV_VERSION}*.deb ../libuv1_${LIBUV_VERSION}*.deb
COPY src/v${PKGVER}.tar.gz $HOME/
RUN mkdir -p $HOME/h2o/h2o-${PKGVER} \
&& cd $HOME/h2o/h2o-${PKGVER} \
&& tar xzf $HOME/v${PKGVER}.tar.gz --strip-components=1 \
&& tar cJf ../h2o_${PKGVER}.orig.tar.xz .
ADD src/debian/ /tmp/h2o/h2o-${PKGVER}/debian/
RUN cd /tmp/h2o/h2o-${PKGVER} \
ADD src/debian/ $HOME/h2o/h2o-${PKGVER}/debian/
RUN cd $HOME/h2o/h2o-${PKGVER} \
&& sudo chown -R builder:builder debian \
&& mv -f debian/changelog.ubuntu1404 debian/changelog \
&& rm -f debian/changelog.* \
&& rm -f debian/changelog.*
RUN cd $HOME/h2o/h2o-${PKGVER} \
&& dpkg-buildpackage -us -uc \
&& tar -czf /tmp/h2o.tar.gz -C /tmp/h2o --exclude=./h2o-${PKGVER} .
&& tar -czf /tmp/h2o.tar.gz -C $HOME/h2o --exclude=./h2o-${PKGVER} .
CMD ["/bin/true"]
26 changes: 17 additions & 9 deletions Dockerfile.ubuntu1604
Expand Up @@ -25,16 +25,24 @@ RUN apt-get update \
pkg-config \
ruby \
ruby-dev \
starlet
COPY src/v${PKGVER}.tar.gz /tmp/
RUN mkdir -p /tmp/h2o/h2o-${PKGVER} \
&& cd /tmp/h2o/h2o-${PKGVER} \
&& tar xzf /tmp/v${PKGVER}.tar.gz --strip-components=1 \
starlet \
sudo
RUN useradd -ms /bin/bash builder \
&& echo "builder ALL=NOPASSWD: ALL" > /etc/sudoers.d/builder \
&& chmod 440 /etc/sudoers.d/builder
ENV HOME=/home/builder
USER builder
COPY src/v${PKGVER}.tar.gz $HOME/
RUN mkdir -p $HOME/h2o/h2o-${PKGVER} \
&& cd $HOME/h2o/h2o-${PKGVER} \
&& tar xzf $HOME/v${PKGVER}.tar.gz --strip-components=1 \
&& tar cJf ../h2o_${PKGVER}.orig.tar.xz .
ADD src/debian/ /tmp/h2o/h2o-${PKGVER}/debian/
RUN cd /tmp/h2o/h2o-${PKGVER} \
ADD src/debian/ $HOME/h2o/h2o-${PKGVER}/debian/
RUN cd $HOME/h2o/h2o-${PKGVER} \
&& sudo chown -R builder:builder debian \
&& mv -f debian/changelog.ubuntu1604 debian/changelog \
&& rm -f debian/changelog.* \
&& rm -f debian/changelog.*
RUN cd $HOME/h2o/h2o-${PKGVER} \
&& dpkg-buildpackage -us -uc \
&& tar -czf /tmp/h2o.tar.gz -C /tmp/h2o --exclude=./h2o-${PKGVER} .
&& tar -czf /tmp/h2o.tar.gz -C $HOME/h2o --exclude=./h2o-${PKGVER} .
CMD ["/bin/true"]
28 changes: 0 additions & 28 deletions src/debian/patches/01-avoid-test-failure.patch
Expand Up @@ -19,16 +19,6 @@
my $jresp = decode_json("$resp");
is $jresp->{'connections'}, undef, "Connections not present";
is $jresp->{'requests'}, undef, "Requests not present";
--- a/t/50fastcgi.t
+++ b/t/50fastcgi.t
@@ -14,6 +14,7 @@
if system("perl -MPlack::Handler::FCGI /dev/null > /dev/null 2>&1") != 0;

my $tempdir = tempdir(CLEANUP => 1);
+chmod 0755, $tempdir;
my $fcgi_port = empty_port();

# gather information of test data
--- a/t/50reverse-proxy-added-headers.t
+++ b/t/50reverse-proxy-added-headers.t
@@ -14,7 +14,7 @@
Expand All @@ -42,14 +32,6 @@
},
--- a/t/50reverse-proxy-disconnected-keepalive.t
+++ b/t/50reverse-proxy-disconnected-keepalive.t
@@ -27,6 +27,7 @@
});

my $upstream = spawn_upstream($sockfn);
+ chmod 0777, $sockfn;
doit("[unix:$sockfn]");
};

@@ -63,7 +64,8 @@
my $addr = shift;
spawn_server(
Expand All @@ -71,13 +53,3 @@
is_ready => sub {
check_port($upstream_port);
},
--- a/t/50reverse-proxy/test.pl
+++ b/t/50reverse-proxy/test.pl
@@ -74,6 +74,7 @@
},
);
};
+chmod 0777, $unix_socket_file if $unix_socket_file;

my $server = spawn_h2o(<< "EOT");
hosts:

0 comments on commit a55adec

Please sign in to comment.