Files
go-nkode/Dockerfile

42 lines
876 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
VOLUME /app/data/icons
# 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
# Stage 2: Runtime
FROM debian:bookworm-slim
#ENV FRONTEND_HOST=https://app.nkode.tech
ENV FRONTEND_HOST=http://localhost:8090
ENV SVG_DIR=/app/data/icons
ENV DB_PATH=/app/data/sqlite/nkode.db
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 8080
# Command to run the application
CMD ["./go-nkode"]