-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile.trace
39 lines (29 loc) · 1.16 KB
/
Dockerfile.trace
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
# Stage 0: Build #
# Use the official Golang image to create a build artifact.
# This is based on Debian and sets the GOPATH to /go.
FROM golang:1.19 as BUILDER
# Create and change to the app directory.
WORKDIR /app
# Retrieve application dependencies using go modules.
# Allows container builds to reuse downloaded dependencies.
COPY go.* ./
RUN go mod download
# Copy local code to the container image.
COPY . ./
# Build the binary.
WORKDIR /app/server/trace-func-go
# -mod=readonly: ensures immutable go.mod and go.sum in container builds.
# CGO_ENABLED=1: uses common libraries found on most major OS distributions.
# GOARCH=amd64 GOGCCFLAGS=-m64: specifies x86, 64-bit GCC.
RUN CGO_ENABLED=1 GOARCH=amd64 GOGCCFLAGS=-m64 GOOS=linux go build -mod=readonly -v -o server
# Stage 1: Run #
FROM debian:stable-slim
ARG FUNC_TYPE
ENV FUNC_TYPE_ENV=${FUNC_TYPE}
ARG FUNC_PORT
ENV FUNC_PORT_ENV=${FUNC_PORT}
# Copy the binary to the production image from the BUILDER stage.
COPY --from=BUILDER /app/server/trace-func-go/server /server
# Run the web service on container startup.
ENTRYPOINT ["/server"]
LABEL org.opencontainers.image.source=https://github.com/vhive-serverless/invitro