-
Notifications
You must be signed in to change notification settings - Fork 241
/
Dockerfile.in
49 lines (42 loc) · 1.69 KB
/
Dockerfile.in
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
# Concatenated after ../Dockerfile to create the tgz
FROM docker.io/fortio/fortio.build:v50 as stage
ARG archs="amd64 arm64 ppc64le s390x"
ENV archs=${archs}
# Build image defaults to build user, switch back to root for
# release making.
USER root:root
WORKDIR /stage
#COPY --from=release /usr/share/fortio usr/share/fortio
COPY docs/fortio.1 usr/share/man/man1/fortio.1
RUN mkdir -p /tgz usr/bin
WORKDIR /build
COPY . fortio
# Check macos does not break
RUN make -C fortio official-build BUILD_DIR=/build OFFICIAL_DIR=/tmp/fortio_mac GOOS=darwin GO_BIN=/usr/local/go/bin/go
# Windows release
RUN make -C fortio official-build BUILD_DIR=/build OFFICIAL_DIR=/tmp/fortio_win GOOS=windows
RUN mv /tmp/fortio_win/fortio.exe /tmp/fortio.exe
# Linux per-architecture binaries building
RUN sh -c \
'set -ex; for arch in ${archs}; do \
make -C fortio official-build BUILD_DIR=/build GOARCH=${arch} OFFICIAL_DIR=/tmp/fortio_${arch}; \
done'
RUN cd fortio && /tmp/fortio_$(go env GOARCH)/fortio version -s > /tmp/version
WORKDIR /stage
# Make per-architecture .tgz files
RUN sh -c \
'set -ex; for arch in ${archs}; do \
cp /tmp/fortio_${arch}/fortio usr/bin/fortio; \
# Make sure the list here is both minimal and complete \
# we could take all of * but that adds system directories to the tar \
tar cvf - usr/share/man/man1/fortio.1 usr/bin/fortio | gzip --best > /tgz/fortio-linux_${arch}-$(cat /tmp/version).tgz; \
rm -f usr/bin/fortio; \
done'
WORKDIR /tmp
RUN zip -9 -r fortio_win_$(cat /tmp/version).zip fortio.exe && mv *.zip /tgz
WORKDIR /tgz
COPY release/ffpm.sh /
RUN bash -x /ffpm.sh deb
RUN bash -x /ffpm.sh rpm
FROM scratch
COPY --from=stage /tgz/ /tgz/