Fix compilation, environment, git repo and command errors

This commit is contained in:
null31 2024-08-30 21:40:46 +02:00
parent 0810154e4b
commit 2d6d9c3959
Signed by: null31
GPG Key ID: CAB4CF4EE49720FF
1 changed files with 9 additions and 7 deletions

View File

@ -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"]
CMD ["./irc_bot"]