forked from kaack/elrs-joystick-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.windows-amd64
140 lines (113 loc) · 5.48 KB
/
Dockerfile.windows-amd64
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# SPDX-FileCopyrightText: © 2023 OneEyeFPV [email protected]
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-License-Identifier: FS-0.9-or-later
FROM mcr.microsoft.com/windows/servercore:ltsc2022 as builder-stage
LABEL maintainer="[email protected]"
# GoLang
ARG GO_VERSION=1.20.6
ARG GO_ZIP_FILE=go${GO_VERSION}.windows-amd64.zip
ARG GO_ZIP_URL=https://dl.google.com/go/${GO_ZIP_FILE}
# protoc
ARG PROTOC_VERSION=23.4
ARG PROTOC_ZIP_FILE=protoc-${PROTOC_VERSION}-win64.zip
ARG PROTOC_ZIP_URL=https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP_FILE}
# protoc-gen-grpc-web
ARG GRPC_WEB_VERSION=1.4.2
ARG GRPC_WEB_ZIP_FILE=protoc-gen-grpc-web-${GRPC_WEB_VERSION}-windows-x86_64.exe
ARG GRPC_WEB_ZIP_URL=https://github.com/grpc/grpc-web/releases/download/${GRPC_WEB_VERSION}/${GRPC_WEB_ZIP_FILE}
# protoc-gen-js
ARG PROTOC_JS_VERSION=3.21.2
ARG PROTOC_JS_ZIP_FILE=protobuf-javascript-${PROTOC_JS_VERSION}-win64.zip
ARG PROTOC_JS_URL=https://github.com/protocolbuffers/protobuf-javascript/releases/download/v${PROTOC_JS_VERSION}/${PROTOC_JS_ZIP_FILE}
# node
ARG NODE_VERSION=18.17.0
ARG NODE_ZIP_URL=https://nodejs.org/dist/v18.17.0/node-v18.17.0-win-x64.zip
# 7z
ARG S7Z_VERSION=2301
ARG S7Z_URL=https://www.7-zip.org/a/7z${S7Z_VERSION}-x64.exe
# mingw
ARG MINGW_VERSION=13.1.0
ARG MINGW_RT=rt_v11-rev1
ARG MINGW_7Z_URL=https://github.com/niXman/mingw-builds-binaries/releases/download/${MINGW_VERSION}-${MINGW_RT}/x86_64-${MINGW_VERSION}-release-win32-seh-msvcrt-${MINGW_RT}.7z
# sdl2
ARG SDL2_VERSION=2.28.1
ARG SDL2_ZIP_FILE=https://github.com/libsdl-org/SDL/releases/download/release-${SDL2_VERSION}/SDL2-devel-${SDL2_VERSION}-mingw.zip
# Restore the default Windows shell for correct batch processing.
SHELL ["cmd", "/S", "/C"]
RUN echo "*** Install Microsoft build tools" && \
curl -sfLO https://aka.ms/vs/17/release/vs_buildtools.exe \
&& (start /w vs_buildtools.exe --quiet --wait --norestart --nocache \
--installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" \
--add Microsoft.VisualStudio.Workload.AzureBuildTools \
--remove Microsoft.VisualStudio.Component.Windows10SDK.10240 \
--remove Microsoft.VisualStudio.Component.Windows10SDK.10586 \
--remove Microsoft.VisualStudio.Component.Windows10SDK.14393 \
--remove Microsoft.VisualStudio.Component.Windows81SDK \
|| IF "%ERRORLEVEL%"=="3010" EXIT 0) \
&& del /q vs_buildtools.exe
RUN echo "*** Install Microsoft Visual C++ redistributable packages runtime" && \
curl -sfLO https://aka.ms/vs/17/release/vc_redist.x64.exe \
&& (start /w vc_redist.x64.exe /install /quiet /norestart /nocache ) \
&& del /q vc_redist.x64.exe
RUN echo "**** Download and install golang version: %GO_VERSION%" \
&& echo "**** url: %GO_ZIP_URL%" \
&& curl -sfLO %GO_ZIP_URL% \
&& tar -xvf %GO_ZIP_FILE% \
&& move go go-sdk \
&& mkdir go \
&& setx path "%path%;C:\go-sdk\bin;C:\go\bin" \
&& setx GOROOT "C:\go-sdk" \
&& setx GOPATH "C:\go"
RUN echo "*** Download and install protoc version %PROTOC_VERSION%" \
&& echo "*** url: %PROTOC_ZIP_URL%" \
&& curl -sfLO %PROTOC_ZIP_URL% \
&& mkdir protoc \
&& tar -xvf %PROTOC_ZIP_FILE% -C protoc \
&& setx path "%path%;C:\protoc\bin"
RUN echo "*** Download and install grpc-web protoc plugin version %GRPC_WEB_VERSION%" \
&& echo "*** url: %GRPC_WEB_ZIP_URL%" \
&& curl -sfLO %GRPC_WEB_ZIP_URL% \
&& move %GRPC_WEB_ZIP_FILE% protoc\bin\protoc-gen-grpc-web.exe
RUN echo "*** Download and install protoc-js version %PROTOC_JS_VERSION%" \
&& echo "*** url: %PROTOC_JS_ZIP_FILE%" \
&& curl -sfLO %PROTOC_JS_URL% \
&& mkdir protoc-js \
&& tar -xvf %PROTOC_JS_ZIP_FILE% -C protoc-js \
&& setx path "%path%;C:\protoc-js\bin"
RUN echo "*** Download and install node version %NODE_VERSION%" \
&& echo "url: %NODE_ZIP_URL%" \
&& curl -sfL %NODE_ZIP_URL% -o node-x64.zip \
&& mkdir node \
&& tar xvf node-x64.zip --strip-components=1 -C node \
&& setx path "%path%;C:\node"
RUN echo "*** Downloading 7z version %S7Z_VERSION%" \
&& echo "url: %S7Z_URL% " \
&& curl -sfL %S7Z_URL% -o 7z-x64.exe \
&& start /b /w 7z-x64.exe /S \
&& setx path "%path%;C:\Program Files\7-Zip"
RUN echo "*** Download and install mingw version %MINGW_VERSION% revision %MINGW_VERSION" \
&& echo "url: %MINGW_7Z_URL%" \
&& curl -sfL %MINGW_7Z_URL% -o mingw.7z\
&& set PATH=%PATH%;C:\Program Files\7-Zip \
&& 7z x mingw.7z
RUN echo "*** Download and install SDL2 version %SDL2_VERSION%" \
&& echo "url: %SDL2_ZIP_FILE%" \
&& curl -sfL %SDL2_ZIP_FILE% -o sdl2-mingw.zip \
&& tar -C mingw64 --strip-components=2 -xvf sdl2-mingw.zip SDL2-%SDL2_VERSION%/x86_64-w64-mingw32
RUN echo "*** Installing protoc-gen-go / protoc-gen-go-grpc" && \
set GOPATH=C:\go&& \
set GOROOT=C:\go-sdk&& \
set GOARCH=amd64&& \
set GOOS=windows&& \
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
RUN echo "*** Running go generate ./..." && \
setx path "%path%;C:\mingw64\bin;C:\mingw64\include" && \
setx CC "gcc" && \
setx CGO_ENABLED "1" && \
setx GOPATH "C:\go" && \
setx GOROOT "C:\go-sdk" && \
setx GOARCH "amd64" && \
setx GOOS "windows" && \
mkdir build
ENTRYPOINT ["cmd.exe"]