add and test dockerfile build and run
This commit is contained in:
41
Dockerfile
Normal file
41
Dockerfile
Normal file
@@ -0,0 +1,41 @@
|
||||
# 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"]
|
||||
Reference in New Issue
Block a user