Skip to content

Commit 3f2fd5d

Browse files
committed
Dockerfile.multi-stage: Use toolchain from inside container
This allows for easy cross-compilation
1 parent 4f62adb commit 3f2fd5d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Dockerfile.multi-stage

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM golang:1.20 as build
2+
3+
WORKDIR /app
4+
5+
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
6+
COPY go.mod go.sum ./
7+
RUN go mod download && go mod verify
8+
9+
COPY . .
10+
RUN go build -v ./...
11+
12+
13+
FROM debian:testing-slim
14+
15+
EXPOSE 9436
16+
17+
COPY scripts/start.sh /app/
18+
COPY --from=build /app/mikrotik-exporter /app/mikrotik-exporter
19+
RUN chmod 755 /app/*
20+
21+
ENTRYPOINT ["/app/start.sh"]

0 commit comments

Comments
 (0)