-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (40 loc) · 1.19 KB
/
Dockerfile
File metadata and controls
55 lines (40 loc) · 1.19 KB
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
# Multi-stage Docker build: go-trust binary for LoTE-based trust evaluation
# Builds go-trust from sirosfoundation/go-trust
FROM golang:1.26-alpine AS builder
RUN apk add --no-cache \
git \
build-base \
libxml2-dev \
libxslt-dev \
pkgconfig
WORKDIR /build
RUN git clone https://github.com/sirosfoundation/go-trust.git .
RUN go mod download && \
CGO_ENABLED=1 GOOS=linux go build -a -trimpath \
-ldflags="-X main.Version=${VERSION:-dev} -w -s" \
-o gt ./cmd/gt
# Final runtime stage
FROM alpine:latest
RUN apk add --no-cache \
ca-certificates \
bash \
openssl \
libxml2 \
libxslt \
curl \
&& update-ca-certificates
RUN addgroup -g 1000 appgroup && \
adduser -D -s /bin/sh -u 1000 -G appgroup gotrust
RUN mkdir -p /app /etc/go-trust && \
chown -R gotrust:appgroup /app /etc/go-trust
WORKDIR /app
COPY --from=builder /build/gt .
COPY ./config/config.yaml /etc/go-trust/config.yaml
COPY ./pipeline.yaml ./pipeline.yaml
COPY ./start.sh ./start.sh
RUN chmod +x gt start.sh
USER gotrust
EXPOSE 6002
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://127.0.0.1:6002/healthz || exit 1
CMD ["./start.sh"]