2018-01-02 16:11:59 +00:00
|
|
|
#########################################
|
|
|
|
# Build stage
|
|
|
|
#########################################
|
2018-08-28 15:48:52 +00:00
|
|
|
FROM golang:1.10 AS builder
|
2014-09-23 18:21:43 +00:00
|
|
|
|
2018-01-02 16:11:59 +00:00
|
|
|
# Repository location
|
|
|
|
ARG REPOSITORY=github.com/ncarlier
|
2014-09-23 18:21:43 +00:00
|
|
|
|
2018-01-02 16:11:59 +00:00
|
|
|
# Artifact name
|
|
|
|
ARG ARTIFACT=webhookd
|
2014-09-23 18:21:43 +00:00
|
|
|
|
2018-01-02 16:11:59 +00:00
|
|
|
# Copy sources into the container
|
|
|
|
ADD . /go/src/$REPOSITORY/$ARTIFACT
|
2014-09-23 18:21:43 +00:00
|
|
|
|
2018-01-02 16:11:59 +00:00
|
|
|
# Set working directory
|
|
|
|
WORKDIR /go/src/$REPOSITORY/$ARTIFACT
|
2014-09-23 18:21:43 +00:00
|
|
|
|
2018-01-02 16:11:59 +00:00
|
|
|
# Build the binary
|
|
|
|
RUN make
|
2014-09-23 18:21:43 +00:00
|
|
|
|
2018-01-02 16:11:59 +00:00
|
|
|
#########################################
|
|
|
|
# Distribution stage
|
|
|
|
#########################################
|
|
|
|
FROM docker:dind
|
2014-09-23 18:21:43 +00:00
|
|
|
|
2018-01-02 16:11:59 +00:00
|
|
|
# Repository location
|
|
|
|
ARG REPOSITORY=github.com/ncarlier
|
2014-09-23 18:21:43 +00:00
|
|
|
|
2018-01-02 16:11:59 +00:00
|
|
|
# Artifact name
|
|
|
|
ARG ARTIFACT=webhookd
|
2014-09-23 18:21:43 +00:00
|
|
|
|
2018-01-02 16:11:59 +00:00
|
|
|
# Fix lib dep
|
|
|
|
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
|
2014-09-23 18:21:43 +00:00
|
|
|
|
2018-01-05 14:37:50 +00:00
|
|
|
# Install deps
|
2018-05-06 09:00:27 +00:00
|
|
|
RUN apk add --no-cache git openssh-client jq bash
|
|
|
|
|
|
|
|
# Create folder structure
|
|
|
|
RUN mkdir -p /var/opt/webhookd/scripts /var/opt/webhookd/work
|
2018-01-05 14:37:50 +00:00
|
|
|
|
2018-01-15 10:51:15 +00:00
|
|
|
# Install binary and default scripts
|
2018-01-02 16:11:59 +00:00
|
|
|
COPY --from=builder /go/src/$REPOSITORY/$ARTIFACT/release/$ARTIFACT-linux-amd64 /usr/local/bin/$ARTIFACT
|
2018-05-06 09:00:27 +00:00
|
|
|
COPY --from=builder /go/src/$REPOSITORY/$ARTIFACT/scripts /var/opt/webhookd/scripts
|
2018-07-06 14:07:09 +00:00
|
|
|
COPY docker-entrypoint.sh /
|
|
|
|
|
2018-07-06 14:10:53 +00:00
|
|
|
# Define entrypoint
|
2018-07-06 14:07:09 +00:00
|
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
2014-09-23 18:21:43 +00:00
|
|
|
|
2018-01-05 14:37:50 +00:00
|
|
|
# Define command
|
|
|
|
CMD webhookd
|
|
|
|
|