-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
ARG GO_VERSION=1.13.5 | ||
|
||
# OS-X SDK parameters | ||
# NOTE: when changing version here, make sure to also change OSX_CODENAME below to match | ||
ARG OSX_SDK=MacOSX10.10.sdk | ||
ARG OSX_SDK_SUM=631b4144c6bf75bf7a4d480d685a9b5bda10ee8d03dbf0db829391e2ef858789 | ||
|
||
# OSX-cross parameters. Go 1.11 requires OSX >= 10.10 | ||
ARG OSX_VERSION_MIN=10.10 | ||
ARG OSX_CROSS_COMMIT=a9317c18a3a457ca0a657f08cc4d0d43c6cf8953 | ||
|
||
# Libtool parameters | ||
ARG LIBTOOL_VERSION=2.4.6 | ||
ARG OSX_CODENAME=yosemite | ||
|
||
FROM golang:${GO_VERSION}-buster AS base | ||
ARG APT_MIRROR | ||
RUN sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" /etc/apt/sources.list \ | ||
&& sed -ri "s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g" /etc/apt/sources.list | ||
ENV OSX_CROSS_PATH=/osxcross | ||
|
||
FROM base AS osx-sdk | ||
ARG OSX_SDK | ||
ARG OSX_SDK_SUM | ||
ADD https://s3.dockerproject.org/darwin/v2/${OSX_SDK}.tar.xz "${OSX_CROSS_PATH}/tarballs/${OSX_SDK}.tar.xz" | ||
RUN echo "${OSX_SDK_SUM}" "${OSX_CROSS_PATH}/tarballs/${OSX_SDK}.tar.xz" | sha256sum -c - | ||
|
||
FROM base AS osx-cross-base | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
# Dependencies for https://github.com/tpoechtrager/osxcross: | ||
# TODO split these into "build-time" and "runtime" dependencies so that build-time deps do not end up in the final image | ||
RUN apt-get update -qq && apt-get install -y -q --no-install-recommends \ | ||
clang \ | ||
file \ | ||
llvm \ | ||
patch \ | ||
xz-utils \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
FROM osx-cross-base AS osx-cross | ||
ARG OSX_CROSS_COMMIT | ||
WORKDIR "${OSX_CROSS_PATH}" | ||
RUN git clone https://github.com/tpoechtrager/osxcross.git . \ | ||
&& git checkout -q "${OSX_CROSS_COMMIT}" \ | ||
&& rm -rf ./.git | ||
COPY --from=osx-sdk "${OSX_CROSS_PATH}/." "${OSX_CROSS_PATH}/" | ||
ARG OSX_VERSION_MIN | ||
RUN UNATTENDED=yes OSX_VERSION_MIN=${OSX_VERSION_MIN} ./build.sh | ||
|
||
FROM base AS libtool | ||
ARG LIBTOOL_VERSION | ||
ARG OSX_CODENAME | ||
ARG OSX_SDK | ||
RUN mkdir -p "${OSX_CROSS_PATH}/target/SDK/${OSX_SDK}/usr/" | ||
RUN curl -fsSL "https://homebrew.bintray.com/bottles/libtool-${LIBTOOL_VERSION}.${OSX_CODENAME}.bottle.tar.gz" \ | ||
| gzip -dc | tar xf - \ | ||
-C "${OSX_CROSS_PATH}/target/SDK/${OSX_SDK}/usr/" \ | ||
--strip-components=2 \ | ||
"libtool/${LIBTOOL_VERSION}/include/" \ | ||
"libtool/${LIBTOOL_VERSION}/lib/" | ||
|
||
FROM osx-cross-base AS final | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update -qq && apt-get install -y -q --no-install-recommends \ | ||
libltdl-dev \ | ||
gcc-mingw-w64 \ | ||
musl-tools \ | ||
parallel \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ARG GORELEASER_VERSION=0.124.1 | ||
ARG GORELEASER_DOWNLOAD_FILE=goreleaser_Linux_x86_64.tar.gz | ||
ARG GORELEASER_DOWNLOAD_URL=https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/${GORELEASER_DOWNLOAD_FILE} | ||
|
||
RUN wget ${GORELEASER_DOWNLOAD_URL}; \ | ||
tar -xzf $GORELEASER_DOWNLOAD_FILE -C /usr/bin/ goreleaser; \ | ||
rm $GORELEASER_DOWNLOAD_FILE; | ||
|
||
COPY --from=osx-cross "${OSX_CROSS_PATH}/." "${OSX_CROSS_PATH}/" | ||
COPY --from=libtool "${OSX_CROSS_PATH}/." "${OSX_CROSS_PATH}/" | ||
ENV PATH=${OSX_CROSS_PATH}/target/bin:$PATH | ||
|
||
ENTRYPOINT ["goreleaser"] | ||
CMD ["-v"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
# xgoreleaser | ||
# oryd/xgoreleaser | ||
|
||
This image is published as [oryd/xgoreleaser](). It's tag (e.g. 1.13.5) reflects the Golang version used. | ||
This is a fork of [docker/golang-cross](https://github.com/docker/golang-cross). | ||
|
||
To build this image, run locally: | ||
|
||
```shell script | ||
$ docker build -t oryd/xgoreleaser:1.13.5 . | ||
``` | ||
|
||
To build this image using the CI, create a new release with the desired Golang version |