41 lines
764 B
Docker
41 lines
764 B
Docker
FROM golang:1.24.4-alpine3.22 AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY go.mod go.sum ./
|
|
COPY docs /app/docs/
|
|
COPY frontend /app/frontend/
|
|
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o lst_go ./main.go
|
|
|
|
FROM alpine:latest
|
|
|
|
WORKDIR /root/
|
|
|
|
# Copy only the binary (no need for source files)
|
|
RUN mkdir -p ./docs ./frontend
|
|
|
|
COPY --from=builder /app/lst_go .
|
|
COPY --from=builder /app/docs ./docs/
|
|
COPY --from=builder /app/frontend ./frontend/
|
|
|
|
# create the volume paths
|
|
RUN mkdir -p /data
|
|
VOLUME /data
|
|
|
|
# this port is hardcoded in the app right now.
|
|
EXPOSE 8080
|
|
ENV RUNNING_IN_DOCKER=true
|
|
|
|
# VOLUME /data
|
|
# ENV DB_TYPE=sqlite
|
|
# ENV DB_PATH=/data/lst_go.db
|
|
# ENV POSTGRES_HOST=host
|
|
# ENV POSTGRES_USER=user
|
|
# ENV POSTGRES_PASSWORD=pass
|
|
|
|
CMD ["./lst_go"] |