All Projects → x1unix → docker-go-mingw

x1unix / docker-go-mingw

Licence: MIT license
Docker image for building Go binaries with MinGW toolchain

Programming Languages

shell
77523 projects
go
31211 projects - #10 most used programming language
Makefile
30231 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to docker-go-mingw

setup-mingw
GitHub action to set up MinGW-w64
Stars: ✭ 51 (+54.55%)
Mutual labels:  mingw, mingw-w64
ci playground
Playground for Cloud CI development for C++
Stars: ✭ 23 (-30.3%)
Mutual labels:  mingw, mingw-w64
fdk-aac-win32-builder
libfdk-aac for Windows binary builder
Stars: ✭ 25 (-24.24%)
Mutual labels:  mingw
aapt-cmake-buildscript
aapt cmake构建系统,支持mac和linux(ubuntu 16.0.4)构建,支持linux(ubuntu 16.0.4)交叉编译windows版本,支持x86和x86_64构建
Stars: ✭ 28 (-15.15%)
Mutual labels:  mingw-w64
pulseaudio-win32
An up-to-date PulseAudio build for Windows with an installer, service, socket support, bug fixes, and new features.
Stars: ✭ 38 (+15.15%)
Mutual labels:  mingw-w64
Hello-GLUT
A very simple "Hello World!" GLUT application demonstrating how to write OpenGL applications in C with MinGW and MSVC.
Stars: ✭ 27 (-18.18%)
Mutual labels:  mingw
wsock-trace
Tracing library for Winsock calls.
Stars: ✭ 15 (-54.55%)
Mutual labels:  mingw
faur
⚒️✨ My personal C games framework. 2D graphics, sound, inputs, states, ECS, and misc utils for data, files, math, memory, strings, time, and more. Builds for Linux, Windows, Web, and embedded devices.
Stars: ✭ 55 (+66.67%)
Mutual labels:  mingw
openconnect
OpenConnect (mirror from official repository with pre-build MinGW binary/libraries)
Stars: ✭ 23 (-30.3%)
Mutual labels:  mingw
asmCrashReport
🐞 Installs signal handlers to capture stack traces for MinGW 32 and macOS builds.
Stars: ✭ 39 (+18.18%)
Mutual labels:  mingw
win-sudo
Add `sudo` command to Git Bash
Stars: ✭ 145 (+339.39%)
Mutual labels:  mingw
build-scripts
Utility scripts for building of 3rd-party libraries
Stars: ✭ 33 (+0%)
Mutual labels:  mingw
Simdjson
Parsing gigabytes of JSON per second
Stars: ✭ 15,115 (+45703.03%)
Mutual labels:  mingw-w64
aapt-repo-manifest
aapt cmake 构建 核心repo manifest, 支持mac和linux(ubuntu 16.0.4)构建,支持linux(ubuntu 16.0.4)交叉编译windows的版本
Stars: ✭ 18 (-45.45%)
Mutual labels:  mingw-w64
mcfgthread
Cornerstone of the MOST efficient std::thread on Windows for mingw-w64
Stars: ✭ 143 (+333.33%)
Mutual labels:  mingw-w64
gdb
Unofficial Windows build of gdb with added features.
Stars: ✭ 36 (+9.09%)
Mutual labels:  mingw-w64
fp256
An efficient library for 256 bit integer arithmetic
Stars: ✭ 21 (-36.36%)
Mutual labels:  mingw-w64
libsrcnn
Super-Resolution imaging with Convolutional Neural Network library for G++, Non-OpenCV model.
Stars: ✭ 14 (-57.58%)
Mutual labels:  mingw-w64
conex
Conex integrates Docker with testing package so you can easily run your integration tests with containers.
Stars: ✭ 79 (+139.39%)
Mutual labels:  docker-golang
go-microepoch
A complete DevOps cycle for Building and Deploying a Go Application to Kubernetes cluster.
Stars: ✭ 34 (+3.03%)
Mutual labels:  docker-golang

go-mingw

Docker Hub Docker Hub

Docker image for building Go binaries for Windows with MinGW-w64 toolchain based on official Go Docker image.

The repository provides simple cross-compilation environment for windows 32 and 64bit builds.

Usage

You can pull Docker image with desired Go version from Docker Hub:

docker pull x1unix/go-mingw:latest # or "1.17" for specific Go version

Recommended: Please take a look at full project build example before starting to work.

Building Go applications inside container

Mount directory with app source and build it:

docker run --rm -it -v /YourPackageSrc:/go/work \
    -w /go/work \
    x1unix/go-mingw go build .

You will get compiled Windows binary.

For 32-bit toolchain

To build a 32-bit executable, set GOARCH=386 variable:

docker run --rm -it -e GOARCH=386 -v /YourPackageSrc:/go/work \
    -w /go/work \
    x1unix/go-mingw go build .

Recommended: See full project build example here.

Go linker flags override

You can override Go linker flags and other flags by specifying environment variable for a container using -e option.

Example:

docker exec -it
    -e LDFLAGS="-linkmode external -extldflags '-static -s -w'"
    ...

Produced files ownership

By default, the container starts as root user. It means, that all produced files will be owned by root:root user.

To set files to be owned by your current user by default, you need to start the container with your current uid/gid.

Use -u flag to start container with different user/group id.

# Start container as other uid/gid
docker exec --rm -it -u "$UID:$GID" ...

Attention: we recommend to mount your host GOPATH and GOCACHE instead of separated volumes approach when using UID/GID other than root.

Go Build Cache

In order to speed up build times and keep Go build cache, you can mount your Go build cache directory or create a separate Docker volume for it.

Local GOPATH

docker run --rm -it \
    -u $UID \
    -v /YourPackageSrc:/go/work \
    -v $(go env GOCACHE):/go/cache \
    -e GOCACHE=/go/cache \
    -w /go/work \
    x1unix/go-mingw go build .

Volume:

# Create Docker volume
docker volume create go-cache

# Run container with attached volume
docker run --rm -it \
    -v /YourPackageSrc:/go/work \
    -v go-cache:/go/cache \
    -e GOCACHE=/go/cache \
    -w /go/work \
    x1unix/go-mingw go build .

See Docker volumes docs for more info.

Go modules cache

In addition to Go build cache, you may also want to mount Go modules cache to avoid modules re-download on each build.

To do this, mount your GOPATH or Go modules directory ($GOPATH/pkg).

Building custom Docker image

You can build image locally with specified Go version:

make image GO_VERSION=1.17

Replace 1.17 with desired Go version.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].