tonyslist/Dockerfile

47 lines
1.3 KiB
Docker

FROM debian:bookworm as base
RUN apt update && \
apt install -y bash-completion build-essential git wget make npm vim keychain libvips libvips-tools exiftool sqlite3
# Configure sqlite3
RUN echo ".headers on\n.mode column" > /root/.sqliterc
FROM base as builder
ENV GO_VERSION 1.24.3
ENV GO_TAR "go-${GO_VERSION}.tar.gz"
RUN wget -q https://go.dev/dl/go${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz -O ${GO_TAR} && \
tar -C /usr/local -xzf ${GO_TAR} && \
rm ${GO_TAR}
ENV PATH="${PATH}:/usr/local/go/bin:/root/go/bin"
RUN go install --tags "foreign_keys fts5" github.com/sqlc-dev/sqlc/cmd/sqlc@latest
# Copy static from the build directory so it contains the generated css.
COPY . /build
WORKDIR /build
RUN make build
FROM debian:bookworm as prod
RUN apt update && \
apt install -y libvips libvips-tools exiftool sqlite3
COPY db /db
COPY templates /templates
COPY --from=builder /build/orcashub /orcashub
COPY --from=builder /build/static /static
# This makes viewing the logs much easier. This variable can be overridden at
# runtime if necessary. The database always stores events in UTC. The retrieval
# code handles this correctly.
ENV TZ="America/Los_Angeles"
ENV APP_ENVIRONMENT="prod"
WORKDIR /
USER 1000
EXPOSE 8000
ENTRYPOINT ["/orcashub"]