diff --git a/apps/authserver/Dockerfile b/apps/authserver/Dockerfile index a20d252..ece76ec 100644 --- a/apps/authserver/Dockerfile +++ b/apps/authserver/Dockerfile @@ -1,5 +1,8 @@ FROM --platform=${BUILDPLATFORM} golang:1.21-alpine AS build +ARG TARGETOS +ARG TARGETARCH + # runs from project directory WORKDIR / @@ -7,7 +10,7 @@ COPY . . RUN go mod download -RUN go build /apps/authserver/cmd/authserver/main.go +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" /apps/authserver/cmd/authserver/main.go FROM alpine:3.19 diff --git a/apps/charserver/Dockerfile b/apps/charserver/Dockerfile index 95118e4..171a608 100644 --- a/apps/charserver/Dockerfile +++ b/apps/charserver/Dockerfile @@ -1,12 +1,15 @@ FROM --platform=${BUILDPLATFORM} golang:1.21-alpine AS build +ARG TARGETOS +ARG TARGETARCH + # runs from project directory WORKDIR / COPY . . RUN go mod download -RUN go build /apps/charserver/cmd/charserver/main.go +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" /apps/charserver/cmd/charserver/main.go FROM alpine:3.19 diff --git a/apps/chatserver/Dockerfile b/apps/chatserver/Dockerfile index 220298c..5a6c378 100644 --- a/apps/chatserver/Dockerfile +++ b/apps/chatserver/Dockerfile @@ -1,12 +1,15 @@ FROM --platform=${BUILDPLATFORM} golang:1.21-alpine AS build +ARG TARGETOS +ARG TARGETARCH + # runs from project directory WORKDIR / COPY . . RUN go mod download -RUN go build /apps/chatserver/cmd/chatserver/main.go +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" /apps/chatserver/cmd/chatserver/main.go FROM alpine:3.19 diff --git a/apps/game-load-balancer/Dockerfile b/apps/game-load-balancer/Dockerfile index 4ea3256..e062e2a 100644 --- a/apps/game-load-balancer/Dockerfile +++ b/apps/game-load-balancer/Dockerfile @@ -1,6 +1,9 @@ # syntax = docker/dockerfile:1-experimental FROM --platform=${BUILDPLATFORM} golang:1.21-alpine AS build +ARG TARGETOS +ARG TARGETARCH + # runs from project directory WORKDIR / @@ -9,7 +12,7 @@ RUN go mod download COPY . . -RUN go build /apps/game-load-balancer/cmd/game-load-balancer/main.go +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" /apps/game-load-balancer/cmd/game-load-balancer/main.go FROM alpine:3.19 diff --git a/apps/groupserver/Dockerfile b/apps/groupserver/Dockerfile index 626c050..3352cfb 100644 --- a/apps/groupserver/Dockerfile +++ b/apps/groupserver/Dockerfile @@ -1,12 +1,15 @@ FROM --platform=${BUILDPLATFORM} golang:1.21-alpine AS build +ARG TARGETOS +ARG TARGETARCH + # runs from project directory WORKDIR / COPY . . RUN go mod download -RUN go build /apps/groupserver/cmd/groupserver/main.go +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" /apps/groupserver/cmd/groupserver/main.go FROM alpine:3.19 diff --git a/apps/guidserver/Dockerfile b/apps/guidserver/Dockerfile index 814b072..343754e 100644 --- a/apps/guidserver/Dockerfile +++ b/apps/guidserver/Dockerfile @@ -1,12 +1,15 @@ FROM --platform=${BUILDPLATFORM} golang:1.21-alpine AS build +ARG TARGETOS +ARG TARGETARCH + # runs from project directory WORKDIR / COPY . . RUN go mod download -RUN go build /apps/guidserver/cmd/guidserver/main.go +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" /apps/guidserver/cmd/guidserver/main.go FROM alpine:3.19 diff --git a/apps/guildserver/Dockerfile b/apps/guildserver/Dockerfile index d116159..f3c6444 100644 --- a/apps/guildserver/Dockerfile +++ b/apps/guildserver/Dockerfile @@ -1,12 +1,15 @@ FROM --platform=${BUILDPLATFORM} golang:1.21-alpine AS build +ARG TARGETOS +ARG TARGETARCH + # runs from project directory WORKDIR / COPY . . RUN go mod download -RUN go build /apps/guildserver/cmd/guildserver/main.go +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" /apps/guildserver/cmd/guildserver/main.go FROM alpine:3.19 diff --git a/apps/mailserver/Dockerfile b/apps/mailserver/Dockerfile index 47c5e25..6eb4944 100644 --- a/apps/mailserver/Dockerfile +++ b/apps/mailserver/Dockerfile @@ -1,12 +1,15 @@ FROM --platform=${BUILDPLATFORM} golang:1.21-alpine AS build +ARG TARGETOS +ARG TARGETARCH + # runs from project directory WORKDIR / COPY . . RUN go mod download -RUN go build /apps/mailserver/cmd/mailserver/main.go +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" /apps/mailserver/cmd/mailserver/main.go FROM alpine:3.19 diff --git a/apps/servers-registry/Dockerfile b/apps/servers-registry/Dockerfile index db3f500..1ae68e9 100644 --- a/apps/servers-registry/Dockerfile +++ b/apps/servers-registry/Dockerfile @@ -1,6 +1,9 @@ # syntax = docker/dockerfile:1-experimental FROM --platform=${BUILDPLATFORM} golang:1.21-alpine AS build +ARG TARGETOS +ARG TARGETARCH + # runs from project directory WORKDIR / @@ -9,7 +12,7 @@ RUN go mod download COPY . . -RUN go build /apps/servers-registry/cmd/servers-registry/main.go +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" /apps/servers-registry/cmd/servers-registry/main.go FROM alpine:3.19 diff --git a/game-server/azerothcore/Dockerfile b/game-server/azerothcore/Dockerfile index 6d43a98..c4d052b 100644 --- a/game-server/azerothcore/Dockerfile +++ b/game-server/azerothcore/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=${BUILDPLATFORM} golang:1.21 AS build-sidecar +FROM golang:1.21 AS build-sidecar # runs from project directory WORKDIR $GOPATH/src/github.com/walkline/ToCloud9 @@ -9,7 +9,7 @@ RUN go mod download RUN go build -o libsidecar.so -buildmode=c-shared ./game-server/libsidecar/ -FROM --platform=${BUILDPLATFORM} ubuntu:22.04 AS build-core +FROM ubuntu:22.04 AS build-core ENV DEBIAN_FRONTEND=noninteractive @@ -58,7 +58,7 @@ WORKDIR /repo/bin RUN cmake --build . --config "RelWithDebInfo" -j $(($(nproc) + 1)) RUN cmake --install . --config "RelWithDebInfo" -FROM --platform=${BUILDPLATFORM} ubuntu:22.04 +FROM ubuntu:22.04 RUN apt-get update && \ apt-get install -y --no-install-recommends \