penambahan template selanjutnya
This commit is contained in:
26
Dockerfile
26
Dockerfile
@@ -1,42 +1,26 @@
|
||||
FROM golang:1.23 AS builder
|
||||
# Install curl dan Tailwind dependencies
|
||||
RUN apt-get update && apt-get install -y curl ca-certificates
|
||||
FROM golang:1.23-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy go.mod dan go.sum untuk dependency management
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
RUN go mod download
|
||||
RUN go mod tidy
|
||||
|
||||
# Copy seluruh project
|
||||
COPY . .
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main ./cmd/api
|
||||
|
||||
# Install Tailwind CSS untuk generate output.css
|
||||
RUN go install github.com/a-h/templ/cmd/templ@latest && \
|
||||
templ generate && \
|
||||
curl -sL https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 -o tailwindcss && \
|
||||
chmod +x tailwindcss && \
|
||||
./tailwindcss -i cmd/web/assets/css/input.css -o cmd/web/assets/css/output.css
|
||||
# RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
# Set timezone ke Asia/Jakarta
|
||||
ENV TZ=Asia/Jakarta
|
||||
|
||||
# Install dependensi runtime yang diperlukan
|
||||
RUN apk --no-cache add ca-certificates tzdata
|
||||
|
||||
WORKDIR /root/
|
||||
|
||||
# Copy binary yang sudah ter-build dari stage sebelumnya
|
||||
COPY --from=builder /app/main .
|
||||
COPY --from=builder /app/.env .
|
||||
|
||||
# Expose port aplikasi
|
||||
EXPOSE 8803
|
||||
|
||||
# Jalankan aplikasi
|
||||
CMD ["./main"]
|
||||
EXPOSE 8084
|
||||
CMD ["./main"]
|
||||
Reference in New Issue
Block a user