Skip to content

Docker Nexus Caching Problem

The Problem

Wine buildtools zip-file

For building in Wine on Linux several Windows buildtools are needed. Of the tools the path needs to be constant so when tool versions are upgraded the path is the same. On the fileserver a directory is created containing symlinks to the actual version of the tool.

win-x86_64-combi/
├── bin
│   ├── 7z.exe -> ../../7-Zip-25.01/7z.exe
│   ├── git.exe -> ../../win-x86_64-git-client/git.exe
│   ├── git.exe.py
│   └── ninja.exe -> ../../win-x86_64-ninja-build-1.13/ninja.exe
├── cmake -> ../../toolchain/win-x86_64-cmake-4.2.2
├── nsis -> ../../toolchain/win-x86_64-nsis-3.11
└── python -> ../../toolchain/w64-x86_64-python-3.12

The directory win-x86_64-combi is zipped using the zip --recurse-paths ./ command. The resulting file uploaded to the Nexus library/shared/toolchain folder.

Zip-file Download by Docker

When building the Docker image using the cpp.Dockerfile the file is downloaded using wget and the entrypoint script mounts the zip-file so the Wine layer can access it.

Illustration of the setup

uml diagram

Nexus Apache SSL-proxy

The Nexus service is actually located in an LXC container and behind an Apache SSL-proxy of which the SSL-certificates are provided using acme.sh.

The Symptom

For some reason the Nexus server through the Apache SSL-proxy returned an old version of the zip file. When downloading the same file directly from the LXC container it was the right file.

Also, the Nexus GUI was feeling sluggish.

The Solution for the Future (hopefully)

Although a restart of Apache fixed it, a permanent solution need to be found.

Added EnableSendfile Off and EnableMMAP Off to the configuration file. Since EnableMMAP is by default ON it is probably is the perpetrator. Another one just incase is CacheDisable but for that the cache module must be loaded and that was not the case.

##
## Define DOMAIN, LISTEN_PORT and IP_AND_PORT before including.
##
## Define DOMAIN "nexus.scanframe.com"
## Define IP_AND_PORT "10.0.3.210:8081"
## Define DOCKER_IP_AND_PORT "10.0.3.210:8084"

<IfModule ssl_module>

  <VirtualHost *:443>
    ServerName ${DOMAIN}

    # Configure SSL using an include file.
    Define APP_DOMAIN "${DOMAIN}"
    Include "${CONFIG_DIR}/conf/ssl-acme-domain.conf"

    # SSL Protocol and CypherSuite
    Include ${CONFIG_DIR}/conf/ssl-proto-cypher.conf

    #LogLevel debug
    ErrorLog ${APACHE_LOG_DIR}/nexus-error.log
    CustomLog ${APACHE_LOG_DIR}/nexus-access.log vhost_combined

    ServerSignature Off
    SSLProxyEngine Off

    ############### Added ##################

    # Disable Kernel-level file caching (Fixes "Stale" large files)
    EnableSendfile Off
    EnableMMAP Off

    <IfModule cache_module>
      # Disable internal mod_cache for all URLs.
      CacheDisable /
    </IfModule>

    <IfModule headers_module>
      # Forces Chrome and other clients to re-validate every request
      Header set Cache-Control "no-cache, no-store, must-revalidate"
      Header set Pragma "no-cache"
      Header set Expires "0"
    </IfModule>

    ########################################

    AllowEncodedSlashes NoDecode

    RequestHeader edit Destination ^https http early
    RequestHeader set X-Forwarded-Proto "https"

    # Proxy based on User-Agent
    <IfModule proxy_module>
      RewriteEngine On

      # Detect Docker User-Agent
      #RewriteCond %{HTTP_USER_AGENT} ^Docker.*$ [NC]
      RewriteCond %{REQUEST_URI} ^/v[12]/  [NC]
      RewriteRule ^/(.*) http://${DOCKER_IP_AND_PORT}/$1 [P,L]
      # Default backend server
      RewriteRule ^/(.*) http://${IP_AND_PORT}/$1 [P,L]
      # Needed for Docker push commands.
      ProxyPassReverse / http://${DOCKER_IP_AND_PORT}/
    </IfModule>

    # Proxy requests to the target host
    <Location />
      Order deny,allow
      Allow from all
    </Location>

  </VirtualHost>

</IfModule>

Creating Docker Images Again

To fix the original problem - the missing of buildtools - is to build the concerned image again like shown in Building Qt v6.10.1 Libraries & Docker Images.