QGIS是一个开源的GIS软件,对于遥感测算,地图绘制,可视化地理数据有重要作用。并且经常面临二次开发的需求,下面将详细描述如何使用docker在linux上编译windows版本的应用程序。 注:本文写于大二时期,只有英文版本,并且当时英文写作水平有限😩
This essay contains following four sections:
If you had installed docker on your computer and comprehended the concept of docker container and docker image. We recommend you read the fourth section directly.
Base centos:
$ sudo yum install docker-ce
Base ubuntu:
$ sudo apt-get install docker-ce docker-ce-cli containerd.io`
This section introduces methods of applying docker images and related terms. On the prompt command type:
$ docker images
REPOSITORY | TAG | IMAGE ID | CREATED | SIZE |
---|---|---|---|---|
ubuntu | latest | xxx | 7days ago | xxMB |
Then you will get the above, this command listed all localimages, where "REPOSITORY" is resource of the image and "IMAGE ID" is an unique ID for every image that docker engine generate randomly.
"TAG" is a representation of different edition image. "SIZE" represents the size of image. The more commands you run in the container, the bigger the image that from container commit(especially apt upgrade!) .
When we want to utilize image provided by other people:
$ docker pull {repository:tag}
If you want to remove one of your images:
$ docker rm ubuntu
The container is just like sandboxes that can run applications inside, which is dynamic and able to convert into images. To search all running containers, type the following:
bash$ docker ps
Then will get the following:
CONTAINER ID | IMAGE | COMMAND | CREATED | STATUS | PORTS | NAMES |
---|---|---|---|---|---|---|
xxx | ubuntu | "bin/bash" | 7 days ago | EXIT(0) | xx | generate randomly |
To list all containers, including running and suspended containers, use:
bash$ docker ps -a
To start a container:
bash$ docker run -i -t {image_id} /bin/bash
Alternatively, you can use:
bash$ docker exec -it {container_name} /bin/bash
This keeps the container in the "UP" status, even if you use the exit
command inside.
This section describes how to build the QGIS project using Docker. Assuming you have Docker installed:
Pull the image with Mingw dependencies from the official repository:
bash$ docker pull ghcr.io/qgis/qgis/qgis3-mingw-buildenv-stages:1
Run a container on this image and keep it running:
bash$ docker run -it ghcr.io/qgis/qgis/qgis3-mingw-buildenv-stages:1 /bin/bash
To exit the container:
bash$ exit
Restart the container:
bash$ docker restart {container_name}
Replace {}
with the container name or ID.
Copy QGIS project files into the running container:
bash$ docker cp ./QGIS {container_name}:/workspace
Enter the container and change the directory:
bash$ docker exec -it {container_id} /bin/bash
# cd /workspace/QGIS/ms-windows/mingw
Run the build shell scripts:
bash# ./build.sh
After a while, a /dist
folder will be generated. Compress and copy it to the host system:
bash# tar -cvfz dist.tar.gz ./dist
# exit
Finally, download the compressed file to the Windows system using the "sftp" protocol.
本文作者:James
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!