用于构建支持 SSL 的 uWSGI 的 Dockerfile

Dockerfile for building uWSGI with SSL support

我正在使用以下 Dockerfile 说明(相关摘录)使用 uWSGI 构建一个 Docker 容器:

FROM debian:stretch
RUN apt-get update && \
  apt-get install --no-install-recommends --no-install-suggests -y \
  gcc python3 python3-dev python3-pip python3-setuptools
RUN pip3 install wheel
RUN pip3 install uwsgi

稍后,在调用 WebSocket 时遇到此错误消息:

you need to build uWSGI with SSL support to use the websocket handshake api function

如何在基于 Debian 的 Docker 映像的上下文中构建支持 SSL 的 uWSGI?

以下现在对我有用:

FROM debian:stretch
RUN apt-get update && \
  apt-get install --no-install-recommends --no-install-suggests -y \
  gcc libssl-dev python3 python3-dev python3-pip python3-setuptools
RUN pip3 install wheel
RUN CFLAGS="-I/usr/local/opt/openssl/include" LDFLAGS="-L/usr/local/opt/openssl/lib" \
  UWSGI_PROFILE_OVERRIDE=ssl=true pip3 install uwsgi -Iv

this related answer. I also had to overcome an irritation that stemmed from having installed OpenSSH only in a later part of the Dockerfile: this made it seem as if SSH libraries were available to the uWSGI compilation step when in reality they were not yet present during that step. 回答对我从命令行测试生成的网络套接字很有用。