Skip to content

Commit

Permalink
Merge pull request #10 from leojonathanoh/refactor/tidy-up-variants-d…
Browse files Browse the repository at this point in the history
…efinition-and-dockerfile-template

Refactor: Tidy up variants definition and Dockerfile template
  • Loading branch information
leojonathanoh authored Nov 19, 2021
2 parents cb1b50b + 98988f5 commit 7711dde
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 53 deletions.
4 changes: 2 additions & 2 deletions generate/definitions/VARIANTS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ $VARIANTS = @(
@{
_metadata = @{
components = @( 'varnishdashboard' )
distro = 'ubuntu'
distro_version = '16.04'
platforms = 'linux/386,linux/amd64,linux/arm/v7,linux/arm64,linux/s390x'
VARNISH_AGENT_VERSION = '4.1.4'
VARNISH_DASHBOARD_COMMIT = "e2cc1c854941c9fac18bdfedba2819fa766a5549"
# distro = 'ubuntu'
# distro_version = '16.04'
}
tag = '4.1.4-ubuntu-16.04'
tag_as_latest = $true
Expand Down
44 changes: 17 additions & 27 deletions generate/templates/Dockerfile.ps1
Original file line number Diff line number Diff line change
@@ -1,43 +1,34 @@
@"
FROM ubuntu:16.04
RUN VARNISH_AGENT_VERSION="$( $VARIANT['_metadata']['VARNISH_AGENT_VERSION'] )" \
&& VARNISH_DASHBOARD_COMMIT="e2cc1c854941c9fac18bdfedba2819fa766a5549" \
&& buildDeps="automake build-essential curl ca-certificates libvarnishapi-dev libmicrohttpd-dev libcurl4-gnutls-dev pkg-config python-docutils git" \
&& runDeps="libvarnishapi1 libmicrohttpd10 libcurl4-gnutls-dev" \
"@ + @'
\
# Install Varnish Agent
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& curl -o /tmp/vagent2.tar.gz -SL https://github.com/varnish/vagent2/archive/${VARNISH_AGENT_VERSION}.tar.gz \
&& tar -zxvf /tmp/vagent2.tar.gz -C /tmp/ \
&& rm -rf /tmp/vagent2.tar.gz \
&& cd /tmp/vagent2-${VARNISH_AGENT_VERSION} \
RUN apt-get update \
&& buildDeps="wget ca-certificates git automake build-essential libvarnishapi-dev libmicrohttpd-dev libcurl4-gnutls-dev pkg-config python-docutils" \
&& apt-get install --no-install-recommends -y `$buildDeps \
&& VARNISH_AGENT_VERSION="$( $VARIANT['_metadata']['VARNISH_AGENT_VERSION'] )" \
&& wget -qO- "https://github.com/varnish/vagent2/archive/`$VARNISH_AGENT_VERSION.tar.gz" > /tmp/vagent2.tar.gz \
&& tar -C /tmp -zxvf /tmp/vagent2.tar.gz \
&& cd "/tmp/vagent2-`$VARNISH_AGENT_VERSION" \
&& ./autogen.sh \
&& ./configure \
&& make \
&& make install \
&& ldconfig \
&& rm -rf /tmp/vagent2.tar.gz \
\
# Install Varnish Dashboard
&& mkdir -p /var/www/html \
&& cd /var/www/html \
&& git clone https://github.com/brandonwamboldt/varnish-dashboard.git \
&& cd varnish-dashboard \
&& git checkout ${VARNISH_DASHBOARD_COMMIT} \
&& VARNISH_DASHBOARD_COMMIT="$( $VARIANT['_metadata']['VARNISH_DASHBOARD_COMMIT'] )" \
&& git clone https://github.com/brandonwamboldt/varnish-dashboard.git /var/www/html/varnish-dashboard \
&& cd /var/www/html/varnish-dashboard \
&& git checkout "`$VARNISH_DASHBOARD_COMMIT" \
&& rm -rf .git \
\
# Cleanup
&& apt-get purge -y --auto-remove $buildDeps \
&& apt-get purge --auto-remove -y `$buildDeps \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
\
# Install runtime dependencies
&& apt-get update \
&& apt-get install -y --no-install-recommends $runDeps \
&& runDeps="libvarnishapi1 libmicrohttpd10 libcurl4-gnutls-dev" \
&& apt-get install --no-install-recommends -y `$runDeps \
\
# Cleanup
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -52,5 +43,4 @@ STOPSIGNAL SIGKILL
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["varnish-agent", "-d"]
'@
"@
41 changes: 17 additions & 24 deletions variants/4.1.4-ubuntu-16.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,33 @@
FROM ubuntu:16.04

RUN VARNISH_AGENT_VERSION="4.1.4" \
&& VARNISH_DASHBOARD_COMMIT="e2cc1c854941c9fac18bdfedba2819fa766a5549" \
&& buildDeps="automake build-essential curl ca-certificates libvarnishapi-dev libmicrohttpd-dev libcurl4-gnutls-dev pkg-config python-docutils git" \
&& runDeps="libvarnishapi1 libmicrohttpd10 libcurl4-gnutls-dev" \
\
# Install Varnish Agent
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& curl -o /tmp/vagent2.tar.gz -SL https://github.com/varnish/vagent2/archive/${VARNISH_AGENT_VERSION}.tar.gz \
&& tar -zxvf /tmp/vagent2.tar.gz -C /tmp/ \
&& rm -rf /tmp/vagent2.tar.gz \
&& cd /tmp/vagent2-${VARNISH_AGENT_VERSION} \
RUN apt-get update \
&& buildDeps="wget ca-certificates git automake build-essential libvarnishapi-dev libmicrohttpd-dev libcurl4-gnutls-dev pkg-config python-docutils" \
&& apt-get install --no-install-recommends -y $buildDeps \
&& VARNISH_AGENT_VERSION="4.1.4" \
&& wget -qO- "https://github.com/varnish/vagent2/archive/$VARNISH_AGENT_VERSION.tar.gz" > /tmp/vagent2.tar.gz \
&& tar -C /tmp -zxvf /tmp/vagent2.tar.gz \
&& cd "/tmp/vagent2-$VARNISH_AGENT_VERSION" \
&& ./autogen.sh \
&& ./configure \
&& make \
&& make install \
&& ldconfig \
&& rm -rf /tmp/vagent2.tar.gz \
\
# Install Varnish Dashboard
&& mkdir -p /var/www/html \
&& cd /var/www/html \
&& git clone https://github.com/brandonwamboldt/varnish-dashboard.git \
&& cd varnish-dashboard \
&& git checkout ${VARNISH_DASHBOARD_COMMIT} \
&& VARNISH_DASHBOARD_COMMIT="e2cc1c854941c9fac18bdfedba2819fa766a5549" \
&& git clone https://github.com/brandonwamboldt/varnish-dashboard.git /var/www/html/varnish-dashboard \
&& cd /var/www/html/varnish-dashboard \
&& git checkout "$VARNISH_DASHBOARD_COMMIT" \
&& rm -rf .git \
\
# Cleanup
&& apt-get purge -y --auto-remove $buildDeps \
&& apt-get purge --auto-remove -y $buildDeps \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
\
# Install runtime dependencies
&& apt-get update \
&& apt-get install -y --no-install-recommends $runDeps \
&& runDeps="libvarnishapi1 libmicrohttpd10 libcurl4-gnutls-dev" \
&& apt-get install --no-install-recommends -y $runDeps \
\
# Cleanup
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -48,4 +41,4 @@ RUN chmod +x /docker-entrypoint.sh
STOPSIGNAL SIGKILL

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["varnish-agent", "-d"]
CMD ["varnish-agent", "-d"]

0 comments on commit 7711dde

Please sign in to comment.