golang[90]-使用wine在linux平台操作windows

wine镜像1:

Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
FROM debian:stretch-slim

ENV TZ=Asia/Shanghai
ENV GOROOT=z:\\go

COPY ./sources.list /etc/apt/
# COPY ./go /go

RUN dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y --no-install-recommends \
wine32 \
wine \
ca-certificates && \
rm -rf /var/lib/apt/lists/*

RUN wine --version

WORKDIR /app

makefile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
all: wine-download wine-unzip wine-build wine-clear wine-push

wine-download:
wget https://dl.google.com/go/go1.11.linux-amd64.tar.gz

wine-unzip:
tar zxvf go1.11.linux-amd64.tar.gz

wine-build:
docker build -t i.wannamake.love/library/wine .

wine-clear:
rm -rf go go1.11.linux-amd64.tar.gz

wine-push:
docker push i.wannamake.love/library/wine

.PHONY: all

sources.list

1
2
3
4
5
6
7
8
9
10
11
deb http://mirrors.ustc.edu.cn/debian/ stretch main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian/ stretch main contrib non-free

deb http://mirrors.ustc.edu.cn/debian/ stretch-updates main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian/ stretch-updates main contrib non-free

deb http://mirrors.ustc.edu.cn/debian/ stretch-backports main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian/ stretch-backports main contrib non-free

deb http://mirrors.ustc.edu.cn/debian-security/ stretch/updates main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian-security/ stretch/updates main contrib non-free

wine镜像2

直接使用外部优秀的镜像:

Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
FROM scottyhardy/docker-wine:latest

RUN wine --version
COPY ./docker-entrypoint.sh /usr/local/bin/
COPY ./followquant_api.exe /app/bin/
COPY ./mtmanapi.dll /app/bin/
COPY ./config.json /app/
WORKDIR /app
RUN chmod 777 /usr/local/bin/docker-entrypoint.sh \
&& chmod 777 /app/config.json \
&& ln -s /usr/local/bin/docker-entrypoint.sh /

ENTRYPOINT ["docker-entrypoint.sh"]

docker-entrypoint.sh

1
2
3
4
#!/bin/sh
set -e
echo "123"
exec wine ./bin/followquant_api.exe

参考资料

https://forum.winehq.org/viewtopic.php?t=28797