-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (34 loc) · 982 Bytes
/
Dockerfile
File metadata and controls
46 lines (34 loc) · 982 Bytes
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
# Generate build container
FROM golang:1.26 AS build
# Create working directory for source files
WORKDIR /go/src
# Copy source files into container
COPY go ./go
COPY main.go .
COPY go.mod .
# Set compilation environment variables:
# Enable C-Go
ENV CGO_ENABLED=1
# Set target OS to linux
ENV GOOS=linux
# Download dependencies
RUN go get -d -v ./...
# Compile application to single binary file 'ict'
RUN go build -a -ldflags '-linkmode external -extldflags "-static"' -o /go/src/ict
# Generate runtime container
FROM scratch AS runtime
# Create working directory for binary
WORKDIR /
# Copy compiled binary from build container
COPY --from=build /go/src/ict /ict
# Set default configuration parameters
ENV ALG="ES256"
ENV DEFAULT_TOKEN_PERIOD=3600
ENV MAX_TOKEN_PERIOD=2592000
ENV PORT=8080
ENV DB_SQLITE_FILE="/config/db.sqlite"
ENV CONTEXT_PREFIX="e2e_ctx_"
# Expose the configured TCP port
EXPOSE ${PORT}/tcp
# Define the binary as the entrypoint
ENTRYPOINT ["/ict"]