docker-nginx-auto-ssl icon indicating copy to clipboard operation
docker-nginx-auto-ssl copied to clipboard

Build for linux/arm64/v8

Open mrdziuban opened this issue 2 years ago • 1 comments

Hello, thank you for your work on this project! I find it by far the simplest way to manage my web servers. I wondered if it would be possible to build the docker image for linux/arm64/v8? It looks like the base image (openresty/openresty:alpine-fat) image is available for this architecture so I'm hoping it would be straightforward. Thanks in advance!

mrdziuban avatar Apr 11 '23 17:04 mrdziuban

I've had the same issue. The following made it work for me to run it on an ARM64 server

docker-compose:

nginx:
    build:
      context: ./src/nginx-auto-ssl
      dockerfile: Dockerfile
    env_file:
      - .env
    depends_on:
      - web
    restart: on-failure
    ports:
      - 80:80
      - 443:443
    volumes:
      - ssl-data:/etc/resty-auto-ssl
    environment:
      ALLOWED_DOMAINS: '${DOMAIN}'
      SITES: '${DOMAIN}=web:8000'

Dockerfile:

FROM openresty/openresty:1.19.9.1-12-bionic-aarch64

# allowed domains should be lua match pattern
ENV DIFFIE_HELLMAN='' \
    ALLOWED_DOMAINS='.*' \
    AUTO_SSL_VERSION='0.13.1' \
    FORCE_HTTPS='true' \
    SITES='' \
    LETSENCRYPT_URL='https://acme-v02.api.letsencrypt.org/directory' \
    STORAGE_ADAPTER='file' \
    REDIS_HOST='' \
    REDIS_PORT='6379' \
    REDIS_DB='0' \
    REDIS_KEY_PREFIX='' \
    RESOLVER_ADDRESS='8.8.8.8'

# Update and install packages using apt instead of apk
RUN apt-get update && apt-get install -y bash openssl \
    && /usr/local/openresty/luajit/bin/luarocks install lua-resty-auto-ssl $AUTO_SSL_VERSION \
    && openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 \
    -subj '/CN=sni-support-required-for-valid-ssl' \
    -keyout /etc/ssl/resty-auto-ssl-fallback.key \
    -out /etc/ssl/resty-auto-ssl-fallback.crt \
    && openssl dhparam -out /usr/local/openresty/nginx/conf/dhparam.pem 2048 \
    && rm /etc/nginx/conf.d/default.conf

COPY nginx.conf snippets /usr/local/openresty/nginx/conf/
COPY entrypoint.sh /entrypoint.sh

VOLUME /etc/resty-auto-ssl

ENTRYPOINT ["/entrypoint.sh"]
CMD ["/usr/local/openresty/bin/openresty", "-g", "daemon off;"]

mick-net avatar Feb 02 '24 16:02 mick-net