33 lines
605 B
Docker
33 lines
605 B
Docker
FROM golang:alpine AS builder
|
|
|
|
# Install build tools needed for go-sqlite3 (CGO)
|
|
RUN apk add --no-cache gcc musl-dev
|
|
|
|
WORKDIR /app
|
|
|
|
# Initialize module and get dependencies
|
|
RUN go mod init calendar-service && \
|
|
go get github.com/mattn/go-sqlite3 && \
|
|
go get golang.org/x/crypto/bcrypt && \
|
|
go get golang.org/x/net/webdav && \
|
|
go get github.com/google/uuid
|
|
|
|
COPY main.go .
|
|
|
|
RUN go build -o server main.go
|
|
|
|
# Final Stage
|
|
FROM alpine:latest
|
|
|
|
WORKDIR /root/
|
|
|
|
COPY --from=builder /app/server .
|
|
|
|
# Create directory for sqlite db
|
|
RUN mkdir -p data
|
|
|
|
EXPOSE 8000
|
|
|
|
# Run the server
|
|
CMD ["./server"]
|