Files
api-bpjs-surkon/Dockerfile

50 lines
1.1 KiB
Docker

FROM golang:1.23-alpine AS builder
# Install tzdata dan dependencies build
#RUN apk add --no-cache tzdata build-base
# Set timezone ke Asia/Jakarta
#ENV TZ=Asia/Jakarta
# Install tzdata package for timezone data
RUN apk add --no-cache tzdata
# Set the timezone to Asia/Jakarta
RUN cp /usr/share/zoneinfo/Asia/Jakarta /etc/localtime && echo "Asia/Jakarta" > /etc/timezone
# Verify the timezone is set
RUN date
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod tidy
# Set timezone ke Asia/Jakarta
#ENV TZ="Asia/Jakarta"
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
# RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
FROM alpine:latest
RUN apk --no-cache add ca-certificates
# Install tzdata package for timezone data
RUN apk add --no-cache tzdata
# Set the timezone to Asia/Jakarta
RUN cp /usr/share/zoneinfo/Asia/Jakarta /etc/localtime && echo "Asia/Jakarta" > /etc/timezone
# Verify the timezone is set
RUN date
WORKDIR /root/
COPY --from=builder /app/main .
COPY --from=builder /app/.env .
EXPOSE 8080
CMD ["./main"]