diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..83bfc56 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# ---- Base ---- +FROM alpine:3 AS base +WORKDIR /app + + +# ---- Build ---- +FROM golang:1.19-alpine AS build +WORKDIR /build +# Copy sources +ADD . . +# Get dependencies +RUN go get ./cmd/app +# Compile +RUN CGO_ENABLED=0 go build -a -o app ./cmd/app + + +# ---- Release ---- +FROM base AS release +# Copy build-target +COPY --from=build /build/app . + +CMD ["./app"] diff --git a/build/docker-multiarch.sh b/build/docker-multiarch.sh new file mode 100644 index 0000000..b63426e --- /dev/null +++ b/build/docker-multiarch.sh @@ -0,0 +1,9 @@ +TAG="ruakij/routingtabletowg" +PLATFORM="linux/amd64,linux/arm64/v8,linux/arm/v7" +EXTRA_ARGS="$@" + +docker buildx build \ +--platform $PLATFORM \ +--tag $TAG \ +$EXTRA_ARGS +. diff --git a/build/docker-ownarch.sh b/build/docker-ownarch.sh new file mode 100755 index 0000000..cee8ba8 --- /dev/null +++ b/build/docker-ownarch.sh @@ -0,0 +1,7 @@ +TAG="ruakij/routingtabletowg" +EXTRA_ARGS="$@" + +docker build \ +--tag $TAG \ +$EXTRA_ARGS \ +.