forked from mtlynch/screenjournal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
64 lines (49 loc) · 1.67 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM golang:1.19.1 AS builder
ARG TARGETPLATFORM
COPY ./announce /app/announce
COPY ./auth /app/auth
COPY ./cmd /app/cmd
COPY ./dev-scripts /app/dev-scripts
COPY ./email /app/email
COPY ./handlers /app/handlers
COPY ./markdown /app/markdown
COPY ./metadata /app/metadata
COPY ./random /app/random
COPY ./screenjournal /app/screenjournal
COPY ./store /app/store
COPY ./go.* /app/
WORKDIR /app
RUN TARGETPLATFORM="${TARGETPLATFORM}" ./dev-scripts/build-backend "prod"
FROM debian:stable-20211011-slim AS litestream_downloader
ARG TARGETPLATFORM
ARG litestream_version="v0.3.9"
WORKDIR /litestream
RUN set -x && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
ca-certificates \
wget
RUN set -x && \
if [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
ARCH="arm7" ; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
ARCH="arm64" ; \
else \
ARCH="amd64" ; \
fi && \
set -u && \
litestream_binary_tgz_filename="litestream-${litestream_version}-linux-${ARCH}-static.tar.gz" && \
wget "https://github.com/benbjohnson/litestream/releases/download/${litestream_version}/${litestream_binary_tgz_filename}" && \
mv "${litestream_binary_tgz_filename}" litestream.tgz
RUN tar -xvzf litestream.tgz
FROM alpine:3.15
RUN apk add --no-cache bash tzdata
COPY --from=builder /app/bin/screenjournal /app/screenjournal
COPY --from=litestream_downloader /litestream/litestream /app/litestream
COPY ./docker-entrypoint /app/docker-entrypoint
COPY ./litestream.yml /etc/litestream.yml
COPY ./static /app/static
COPY ./LICENSE /app/LICENSE
WORKDIR /app
ENTRYPOINT ["/app/docker-entrypoint"]
CMD ["-db", "/data/store.db"]