-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile
47 lines (37 loc) · 1016 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM golang:1.12.1
WORKDIR /go/src/app
COPY . .
RUN apt-get update && apt-get install -y mingw-w64 libasound2-dev
ENV GO111MODULE=on
ENV CGO_ENABLED=1
ENV CC=/usr/bin/x86_64-w64-mingw32-gcc
ENV CXX=/usr/bin/x86_64-w64-mingw32-g++
ENV GOOS=windows
ENV GOARCH=amd64
ENV CGO_LDFLAGS="-lmingw32 -lSDL2"
ENV CGO_FLAGS="-D_REENTRANT"
# Windows build
RUN cp -r ./dist/SDL2-2.0.9/x86_64-w64-mingw32 /usr && \
cp -r ./dist/SDL2-2.0.9/i686-w64-mingw32 /usr && \
cp -r ./dist/SDL2_mixer-2.0.4/x86_64-w64-mingw32 /usr && \
cp -r ./dist/SDL2_mixer-2.0.4/i686-w64-mingw32 /usr && \
go build main.go
RUN ls -al main.exe
# Linux build
ENV CC=gcc
ENV CXX=
ENV CGO_LDFLAGS=
ENV CGO_FLAGS="-s -w"
ENV GOOS=linux
ENV GOARCH=amd64
RUN apt-get install -y libsdl2-dev libsdl2-mixer-dev
RUN go get -v github.com/veandco/go-sdl2/sdl@master && go build main.go
RUN ls -al .
# MacOS build
ENV CC=gcc
ENV CXX=
ENV CGO_LDFLAGS=
ENV CGO_FLAGS="-s -w"
ENV GOOS=darwin
ENV GOARCH=amd64
RUN go build -tags static main.go