-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathDockerfile.build-static
More file actions
36 lines (26 loc) · 985 Bytes
/
Dockerfile.build-static
File metadata and controls
36 lines (26 loc) · 985 Bytes
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
# Stage 1: Build webapp
FROM docker.io/node:lts-alpine AS webapp
WORKDIR /build/webapp
COPY webapp/package.json webapp/package-lock.json ./
RUN npm ci
COPY webapp/ ./
RUN npm run build
# Stage 2: Build Go binaries
FROM docker.io/golang:alpine AS builder
WORKDIR /root
USER root
RUN apk add musl-dev gcc libtool m4 autoconf g++ make libblkid util-linux-dev git linux-headers mingw-w64-gcc
RUN wget http://musl.cc/aarch64-linux-musl-cross.tgz -O /tmp/aarch64-linux-musl-cross.tgz && \
tar --strip-components=1 -C /usr/local -xzf /tmp/aarch64-linux-musl-cross.tgz && \
rm /tmp/aarch64-linux-musl-cross.tgz
ADD ./scripts/build-static.sh /build-static.sh
RUN chmod +x /build-static.sh
ADD . /build/garm
# Copy webapp build output to assets directory
COPY --from=webapp /build/webapp/build/ /build/garm/webapp/assets/
ARG GARM_REF
ENV GARM_REF=${GARM_REF}
RUN /build-static.sh
# Stage 3: Export only the binaries
FROM scratch AS export
COPY --from=builder /build/output/ /