forked from monetr/monetr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
71 lines (61 loc) · 2.08 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
65
66
67
68
69
70
71
FROM --platform=$BUILDPLATFORM debian:12-slim AS base_builder
ARG GO_VERSION=1.23.2
WORKDIR /monetr
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
cmake \
# gcc-x86-64-linux-gnu \ # Add these back to support arm64 hosts compiling amd64
# libc6-dev-amd64-cross \
gcc-aarch64-linux-gnu \
libc6-dev-arm64-cross \
git \
nodejs=18.* \
npm \
wget
RUN wget -c https://golang.org/dl/go${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz && tar -C /usr/local -xzf go${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz
ENV GOPATH=/home/go
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH:
RUN git config --global --add safe.directory /monetr
FROM base_builder AS monetr_builder
ARG REVISION
ARG RELEASE
ARG BUILD_HOST
# Multi platform
ARG TARGETOS
ARG TARGETARCH
ARG GOFLAGS
ENV GOFLAGS=$GOFLAGS
COPY . /monetr
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} make release -B
FROM debian:12-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends \
tzdata \
ca-certificates \
locales-all \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN useradd -rm -d /home/monetr -s /bin/bash -g root -G sudo -u 1000 monetr
RUN mkdir -p /etc/monetr && chown -R 1000:1000 /etc/monetr
USER monetr
WORKDIR /home/monetr
EXPOSE 4000
VOLUME ["/etc/monetr"]
ENTRYPOINT ["/usr/bin/monetr"]
CMD ["serve"]
# Build args need to be present in each "FROM"
ARG REVISION
ARG RELEASE
LABEL org.opencontainers.image.url=https://monetr.app
LABEL org.opencontainers.image.source=https://github.com/monetr/monetr
LABEL org.opencontainers.image.authors=elliot.courant@monetr.app
LABEL org.opencontainers.image.vendor="monetr"
LABEL org.opencontainers.image.licenses="FSL-1.1-MIT"
LABEL org.opencontainers.image.title="monetr"
LABEL org.opencontainers.image.description="monetr's budgeting application"
LABEL org.opencontainers.image.version=${RELEASE}
LABEL org.opencontainers.image.revision=${REVISION}
COPY --from=monetr_builder /monetr/build/monetr /usr/bin/monetr