forked from keploy/keploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
executable file
·51 lines (37 loc) · 1.38 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
# === Build Stage ===
FROM golang:1.22 AS build
# Set the working directory
WORKDIR /app
# Define build arguments for ldflags
ARG SENTRY_DSN_DOCKER
ARG VERSION
# Copy the Go module files and download dependencies
COPY go.mod go.sum /app/
RUN go mod download
# Copy the contents of the current directory into the build container
COPY . /app
# Build the keploy binary
RUN go build -tags=viper_bind_struct -ldflags="-X main.dsn=$SENTRY_DSN_DOCKER -X main.version=$VERSION -X main.apiServerURI=$SERVER_URL -X main.gitHubClientID=$GITTHUB_APP_CLIENT_ID" -o keploy .
# === Runtime Stage ===
FROM debian:bookworm-slim
ENV KEPLOY_INDOCKER=true
# Update the package lists and install required packages
RUN apt-get update
RUN apt-get install -y ca-certificates curl sudo && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Docker engine
RUN curl -fsSL https://get.docker.com -o get-docker.sh && \
sh get-docker.sh && \
rm get-docker.sh
# Install docker-compose to PATH
RUN apt install docker-compose -y
# Copy the keploy binary and the entrypoint script from the build container
COPY --from=build /app/keploy /app/keploy
COPY --from=build /app/entrypoint.sh /app/entrypoint.sh
# windows comapatibility
RUN sed -i 's/\r$//' /app/entrypoint.sh
# Make the entrypoint.sh file executable
RUN chmod +x /app/entrypoint.sh
# Set the entrypoint
ENTRYPOINT ["/app/entrypoint.sh", "/app/keploy"]