diff --git a/dockerfile b/dockerfile index 2a778b6..86b8844 100644 --- a/dockerfile +++ b/dockerfile @@ -1,13 +1,15 @@ -FROM debian:12-slim AS builder +FROM synt/musl-cross-make AS builder -ADD url /app/ +ARG GO_VERSION=1.23.0 + +ADD https://fg.q0s.de/null31/irc_bot.git /app WORKDIR /app -RUN apt update && apt upgrade -y && apt install musl musl-dev && \ - git clone https://github.com/richfelker/musl-cross-make.git && \ - cd musl-cross-make && make && make install && cd .. && \ - CGO_ENABLED=1 CC=musl-gcc GOOS=linux GOARCH=amd64 go build -a -ldflags '-extldflags "-static"' -o irc_bot +ENV CGO_ENABLED=1 CC=x86_64-linux-musl-gcc GOOS=linux GOARCH=amd64 PATH=$PATH:/musl-cross-make/output/bin:/usr/local/go/bin + +RUN wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz && tar -zxf go${GO_VERSION}.linux-amd64.tar.gz -C /usr/local && \ + go build -a -ldflags '-extldflags "-static"' -o irc_bot FROM alpine:3.20 @@ -15,4 +17,4 @@ WORKDIR /app COPY --from=builder /app/irc_bot /app/ -CMD ["irc_bot"] \ No newline at end of file +CMD ["./irc_bot"] \ No newline at end of file