Add Dockerfile and .dockerignore for containerization

This commit is contained in:
ar.azizan 2025-07-10 16:39:17 +03:30
parent fbc7562040
commit edf57baccf
2 changed files with 41 additions and 0 deletions

15
.dockerignore Normal file
View File

@ -0,0 +1,15 @@
.git
.vscode
.env
cache.txt
logs.txt
Untitled-1.txt
*.p12
*.json
*.exe
# Go build cache and modules
/tmp
**/tmp
*.out
*.test
vendor/

26
Dockerfile Normal file
View File

@ -0,0 +1,26 @@
# syntax=docker/dockerfile:1
# --- Build stage ---
FROM golang:1.24 as builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o iralex-einvoice main.go
# --- Run stage ---
FROM gcr.io/distroless/base-debian12
WORKDIR /app
COPY --from=builder /app/iralex-einvoice ./iralex-einvoice
COPY --from=builder /app/.env.example ./.env.example
# If you want to provide a default .env, uncomment the next line:
# COPY --from=builder /app/.env ./.env
# Copy any static files or certs if needed (uncomment and adjust as needed)
# COPY --from=builder /app/static ./static
# COPY --from=builder /app/certs ./certs
# Expose the default port (can be overridden by env or flag)
EXPOSE 1404
# Entrypoint
ENTRYPOINT ["/app/iralex-einvoice"]