Multi-arch Docker image buildkit
This commit is contained in:
parent
fcfdc28809
commit
ba4e0a93ed
30
Dockerfile
Normal file
30
Dockerfile
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
FROM alpine:3.14 as intermediate
|
||||||
|
|
||||||
|
RUN mkdir /src
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
# Install the build tools
|
||||||
|
RUN apk add git go make
|
||||||
|
|
||||||
|
# Fetch the source
|
||||||
|
RUN git clone https://github.com/slackhq/nebula.git
|
||||||
|
|
||||||
|
# Compile the Linux binaries for all platforms
|
||||||
|
WORKDIR /src/nebula
|
||||||
|
RUN echo 'bin-linux: $(ALL_LINUX:%=build/%/nebula) $(ALL_LINUX:%=build/%/nebula-cert)' >> Makefile
|
||||||
|
RUN make bin-linux
|
||||||
|
|
||||||
|
# Start from a clean image
|
||||||
|
FROM alpine:3.14
|
||||||
|
|
||||||
|
RUN mkdir /app
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy over the compiled binaries
|
||||||
|
COPY --from=intermediate /src/nebula/build ./
|
||||||
|
|
||||||
|
# Rename the directories from `go env` format to `uname` format
|
||||||
|
RUN mv linux-amd64 linux-x86_64
|
||||||
|
|
||||||
|
COPY docker-entrypoint.sh entrypoint.sh
|
||||||
|
ENTRYPOINT [ "/bin/sh", "/app/entrypoint.sh" ]
|
4
docker-entrypoint.sh
Normal file
4
docker-entrypoint.sh
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Run the platform-specific binary
|
||||||
|
"/app/linux-$(uname -m)/nebula"
|
Loading…
Reference in a new issue