diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a53945d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +sheetless.db +sheetless-server diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d2e42ca --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +# Build stage +FROM golang:1.21-alpine AS builder + +WORKDIR /app + +# Copy go mod and sum files +COPY src/go.mod src/go.sum . + +# Download dependencies +RUN go mod download + +# Copy source code +COPY ./src/ . + +# Build the application +RUN go build -o sheetless-server + +# Runtime stage +FROM alpine:latest + +RUN apk --no-cache add ca-certificates + +WORKDIR /app/ + +# Copy the binary from builder +COPY --from=builder /app . + +# Expose port +EXPOSE 8080 + +# Run the application +CMD ["./sheetless-server"]