-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (41 loc) · 1.42 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
# docker build --pull --rm -f "Dockerfile" -t hios:latest "."
# Stage 1: Build webui
FROM --platform=${BUILDPLATFORM} docker.io/node:16.2.0 as web-builder
ENV NODE_ENV=production
WORKDIR /work/web
RUN --mount=type=bind,target=/work/web/package.json,src=./web/package.json \
--mount=type=bind,target=/work/web/package-lock.json,src=./web/package-lock.json \
--mount=type=cache,target=/root/.npm \
npm ci --include=dev
COPY ./web /work/web/
RUN npm run build
# Stage 2: Build go proxy
FROM --platform=linux/amd64 docker.io/golang:1.18 AS go-builder
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ARG GOOS=$TARGETOS
ARG GOARCH=$TARGETARCH
WORKDIR /go/src/hios.io
RUN --mount=type=bind,target=/go/src/hios.io/go.mod,src=./go.mod \
--mount=type=bind,target=/go/src/hios.io/go.sum,src=./go.sum \
--mount=type=cache,target=/go/pkg/mod \
go mod download
COPY ./ /go/src/hios.io/
ENV CGO_ENABLED=1
CMD make release OS_ARCHS=linux/amd64
# Stage 3: Build go proxy
FROM --platform=linux/arm64 docker.io/golang:1.18 AS go-builder
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ARG GOOS=$TARGETOS
ARG GOARCH=$TARGETARCH
WORKDIR /go/src/hios.io
RUN --mount=type=bind,target=/go/src/hios.io/go.mod,src=./go.mod \
--mount=type=bind,target=/go/src/hios.io/go.sum,src=./go.sum \
--mount=type=cache,target=/go/pkg/mod \
go mod download
COPY ./ /go/src/hios.io/
ENV CGO_ENABLED=1
CMD make release OS_ARCHS=linux/arm64