Skip to content

Instantly share code, notes, and snippets.

@cirocosta
Created July 14, 2019 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cirocosta/29177e40e3fc0ca92e73d94c288a5849 to your computer and use it in GitHub Desktop.
Save cirocosta/29177e40e3fc0ca92e73d94c288a5849 to your computer and use it in GitHub Desktop.
An example of how to build the `concourse/concourse` image with a modified `gdn`
FROM golang AS base
RUN apt update && \
apt install -y \
git gcc libseccomp-dev
ENV \
CC=gcc \
CGO_ENABLED=1
FROM base AS gdn-base
COPY ./src /src
WORKDIR /src/guardian
FROM gdn-base AS gdn-build
RUN go build \
-tags netgo \
-ldflags "-extldflags '-static'" \
-o /bin/gdn \
./cmd/gdn
FROM gdn-base AS gdn-dadoo-build
RUN go build \
-tags netgo \
-ldflags "-extldflags '-static'" \
-o /bin/dadoo \
./cmd/dadoo
FROM gdn-base AS gdn-init-build
RUN set -x && \
cd ./cmd/init && \
$CC -static -o /bin/init \
init.c ignore_sigchild.c
FROM concourse/concourse
ARG RUNC_URL=https://github.com/opencontainers/runc/releases/download/v1.0.0-rc8/runc.amd64
RUN apt update && apt install -y iptables curl
RUN curl -SOL ${RUNC_URL} && install -m 0755 ./runc.amd64 /usr/local/concourse/bin/runc
ENV CONCOURSE_GARDEN_BIN /usr/local/concourse/bin/gdn
ENV CONCOURSE_GARDEN_INIT_BIN /usr/local/concourse/bin/init
ENV CONCOURSE_GARDEN_RUNTIME_PLUGIN /usr/local/concourse/bin/runc
ENV CONCOURSE_GARDEN_DADOO_BIN /usr/local/concourse/bin/dadoo
COPY --from=gdn-dadoo-build /bin/dadoo /usr/local/concourse/bin/dadoo
COPY --from=gdn-init-build /bin/init /usr/local/concourse/bin/init
COPY --from=gdn-build /bin/gdn /usr/local/concourse/bin/gdn
@cirocosta
Copy link
Author

Usage:

  1. clone garden-runc-release, the "umbrella repo" from guardian
$ git clone https://github.com/cloudfoundry/garden-runc-release --recurse-submodules -j4
  1. modify guardian (under ./src/guardian)

  2. build the modified concourse image

$ docker build -t cirocosta/modified-concourse .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment