update worker
This commit is contained in:
No files matched your search
+14
-8
@@ -1,5 +1,5 @@
|
||||
# Multi-stage build yang lebih optimal
|
||||
FROM golang:1.22-alpine AS build
|
||||
FROM golang:1.25-alpine AS build
|
||||
|
||||
# Install build dependencies
|
||||
RUN apk add --no-cache git ca-certificates tzdata
|
||||
@@ -19,8 +19,14 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
||||
-ldflags='-w -s -extldflags "-static"' \
|
||||
-o main cmd/api/main.go
|
||||
|
||||
# Final stage - distroless untuk keamanan
|
||||
FROM gcr.io/distroless/static:nonroot
|
||||
# Final stage - menggunakan tag :debug-nonroot agar memiliki akses shell (BusyBox)
|
||||
FROM gcr.io/distroless/static:debug-nonroot
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV TZ="Asia/Jakarta"
|
||||
# Tambahkan /busybox ke dalam PATH agar command 'sh' bisa langsung dijalankan
|
||||
ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/busybox"
|
||||
|
||||
# Copy timezone data
|
||||
COPY --from=build /usr/share/zoneinfo /usr/share/zoneinfo
|
||||
@@ -28,13 +34,13 @@ COPY --from=build /usr/share/zoneinfo /usr/share/zoneinfo
|
||||
# Copy binary
|
||||
COPY --from=build /build/main /app/main
|
||||
|
||||
# Pastikan folder logs dan data ada agar aplikasi tidak error saat menulis (opsional tapi disarankan)
|
||||
# COPY --from=build --chown=nonroot:nonroot /build/logs /app/logs
|
||||
# COPY --from=build --chown=nonroot:nonroot /build/data /app/data
|
||||
|
||||
# Use non-root user
|
||||
USER nonroot:nonroot
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD ["/app/main", "-health"] || exit 1
|
||||
|
||||
EXPOSE 8080
|
||||
EXPOSE 8198
|
||||
|
||||
ENTRYPOINT ["/app/main"]
|
||||
Reference in New Issue
Block a user