|
|
|
FROM golang:1.21-alpine AS builder |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
RUN apk add --no-cache git |
|
|
|
|
|
COPY . . |
|
|
|
|
|
RUN go mod tidy |
|
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o deepai |
|
|
|
|
|
FROM alpine:latest |
|
|
|
|
|
RUN apk add --no-cache ca-certificates tzdata wget |
|
|
|
|
|
RUN addgroup -S appgroup && adduser -S appuser -G appgroup |
|
|
|
|
|
RUN mkdir -p /app/conf /app/logs && \ |
|
chown -R appuser:appgroup /app |
|
|
|
|
|
COPY --from=builder /app/deepai /app/ |
|
COPY --from=builder /app/config-example.yaml /app/conf/config.yaml |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
RUN chmod 755 /app/deepai && \ |
|
chmod 644 /app/conf/config.yaml && \ |
|
chown -R appuser:appgroup /app |
|
|
|
|
|
USER appuser |
|
|
|
|
|
EXPOSE 8888 |
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s \ |
|
CMD wget --no-verbose --tries=1 --spider http://localhost:8888/health || exit 1 |
|
|
|
|
|
CMD ["/app/deepai"] |
|
|