Skip to content

Instantly share code, notes, and snippets.

@zpeters
Created February 13, 2024 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zpeters/08d325dc3c435f31ab8f0b5ea63260e8 to your computer and use it in GitHub Desktop.
Save zpeters/08d325dc3c435f31ab8f0b5ea63260e8 to your computer and use it in GitHub Desktop.
Docker Container with litestream
FROM docker.io/golang:1.18 as builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -o main .
FROM docker.io/debian:bookworm-slim
RUN apt update; apt -y upgrade; apt install -y wget; wget "https://github.com/benbjohnson/litestream/releases/download/v0.3.13/litestream-v0.3.13-linux-amd64.deb"; dpkg -i "litestream-v0.3.13-linux-amd64.deb"
WORKDIR /root/
COPY --from=builder /app/main .
COPY ./web/ web/
COPY ./assets/ assets/
COPY ./etc/litestream.yml .
EXPOSE 8080
ENV FIBER_PROD=true
# run restore first in case db exists, then run main process
COPY ./start.sh .
CMD ["./start.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment