-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdockerfile
57 lines (43 loc) · 1.66 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
FROM golang:1.24-alpine AS build
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download dependencies and tidy
RUN go mod download && go mod tidy
# Copy source code
COPY . .
# Build the application
RUN go build -o sbom-app .
FROM alpine:latest
WORKDIR /app
# Install required dependencies
RUN apk add --no-cache curl bash syft grype wget tar findutils git
# Install sbomqs directly from GitHub releases
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then \
export SBOMQS_ARCH="amd64"; \
elif [ "$ARCH" = "aarch64" ]; then \
export SBOMQS_ARCH="arm64"; \
else \
echo "Unsupported architecture: $ARCH"; \
export SBOMQS_ARCH="amd64"; \
fi && \
# Download binary directly (releases use direct binaries)
echo "Downloading sbomqs for architecture: ${SBOMQS_ARCH}" && \
wget -q "https://github.com/interlynk-io/sbomqs/releases/download/v1.0.3/sbomqs-linux-${SBOMQS_ARCH}" -O /usr/local/bin/sbomqs && \
chmod +x /usr/local/bin/sbomqs && \
# Verify installation with fallback for errors
{ sbomqs version && echo "sbomqs installed successfully"; } || \
{ echo "WARNING: sbomqs is not installed correctly. Quality scoring will be unavailable but other functionality will continue to work."; }
# Copy the built application
COPY --from=build /app/sbom-app .
# Copy static files and templates
COPY static/ ./static/
# Set environment variables
ENV LLAMA_INDEX_ENDPOINT=http://llama-index-service:8000
ENV OLLAMA_HOST=http://host.docker.internal:11434
ENV DEFAULT_MODEL=mistral
ENV SBOM_OUTPUT_FILE=sbom.cyclonedx.json
ENV LOG_FILE=static/output.log
# Command to run the application
CMD ["./sbom-app"]