Files
go-nkode/Dockerfile
2025-08-05 10:07:24 -05:00

46 lines
1014 B
Docker

# Stage 1: Build
FROM golang:1.23 AS builder
# Set the working directory inside the container
WORKDIR /app
# volume for nkode.db
VOLUME /app/data/sqlite
# Copy go.mod and go.sum files
COPY go.mod go.sum ./
# Download all dependencies
RUN go mod download
# Copy the rest of the application code
COPY . .
# Build the application
RUN go build -o go-nkode ./cmd/restapi
# Stage 2: Runtime
FROM debian:bookworm-slim
# Install ca-certificates and update them
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
update-ca-certificates && \
rm -rf /var/lib/apt/lists/*
#ENV FRONTEND_HOST=https://app.nkode.tech
#ENV FRONTEND_HOST=http://localhost:8090
ENV SQLITE_DB=/app/data/sqlite/nkode.db
# Set the working directory inside the runtime container
WORKDIR /app
# Copy the compiled Go binary from the builder stage
COPY --from=builder /app/go-nkode .
# Expose the port the application will run on
EXPOSE 8090
# Command to run the application
CMD ["./go-nkode"]