forked from ncarlier/webhookd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
58 lines (42 loc) · 1.42 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#########################################
# Build stage
#########################################
FROM golang:1.17 AS builder
# Repository location
ARG REPOSITORY=github.com/ncarlier
# Artifact name
ARG ARTIFACT=webhookd
# Copy sources into the container
ADD . /go/src/$REPOSITORY/$ARTIFACT
# Set working directory
WORKDIR /go/src/$REPOSITORY/$ARTIFACT
# Build the binary
RUN make
#########################################
# Distribution stage
#########################################
FROM docker:dind
# Repository location
ARG REPOSITORY=github.com/ncarlier
# Artifact name
ARG ARTIFACT=webhookd
# Docker Compose version
ARG COMPOSE_VERSION=1.25.4
# Fix lib dep
#RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
# Install deps
RUN apk add --no-cache git openssh-client jq bash curl
# Install docker-compose
RUN curl -L "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/run.sh" \
-o /usr/local/bin/docker-compose && \
chmod +x /usr/local/bin/docker-compose
# Create folder structure
RUN mkdir -p /var/opt/webhookd/scripts /var/opt/webhookd/work
# Install binary and default scripts
COPY --from=builder /go/src/$REPOSITORY/$ARTIFACT/release/$ARTIFACT /usr/local/bin/$ARTIFACT
COPY --from=builder /go/src/$REPOSITORY/$ARTIFACT/scripts /var/opt/webhookd/scripts
COPY docker-entrypoint.sh /
# Define entrypoint
ENTRYPOINT ["/docker-entrypoint.sh"]
# Define command
CMD webhookd