Dockerfile
FROM golang:buster ARG wdir="/sample" COPY . ${wdir} WORKDIR ${wdir} RUN apt-get update && apt-get upgrade && apt-get -y install g++-arm-linux-gnueabihf && \ go install ENV CC arm-linux-gnueabihf-gcc ENV GOOS linux ENV GOARCH arm ENV GOARM 7 ENV CGO_ENABLED 1 CMD ["go", "build", "-o", "sample_bin"]
docker-compose.yml
version: "3.0" services: compiler: build: . volumes: - .:/sample
使い方
docker-compose up compiler // => sample_binという名前でクロスコンパイルされる
View Comments