weserv / images

Source code of wsrv.nl (formerly images.weserv.nl), to be used on your own server(s).
https://wsrv.nl/
BSD 3-Clause "New" or "Revised" License
2.05k stars 200 forks source link

nothing in var/www/imagesweserv/public/ #318

Closed Proka88MPH closed 3 years ago

Proka88MPH commented 3 years ago

Hi, We are trying to build and run docker in Kubernetes but we are getting following error: var/www/imagesweserv/public/service-worker.js" failed (2: No such file or directory)

There is noting in this folder var/www/imagesweserv/public/

We have followed instructions for building docker image. Do you have any advice?

kleisauke commented 3 years ago

Perhaps the git repo was cloned without submodules (i.e. without the --recurse-submodules argument)? For already cloned repositories you can do:

git submodule update --init

You can also use the pre-built hosted image on GitHub Container Registry, which may be easier than manually building the Docker image. For example:

FROM ghcr.io/weserv/images:5.x

# Update RPM packages
RUN dnf update -y

# Overwrite default nginx config
# For example, change DNS settings:
# https://github.com/weserv/images/issues/206#issuecomment-567015037
# Or default user agent:
# https://github.com/weserv/images/issues/223#issuecomment-616219620
# etc, etc:
# https://github.com/weserv/images/tree/5.x/ngx_conf
COPY imagesweserv.conf /etc/nginx
giautm commented 3 years ago

Can we remove Weserv's website from the public Docker image? In most cases, I don't need that site for public access.

Weserv's website can be provided via another image based on the public Docker image.

kleisauke commented 3 years ago

@giautm I don't intend to remove the weserv/docs submodule from the pre-built Docker image, because that would break compatibility for existing users who want our documentation to be served.

If you want a custom page served, I recommend extending it from the pre-built Docker image, for example:

FROM ghcr.io/weserv/images:5.x

ARG NGINX_DEFAULT=https://github.com/nginx/nginx/raw/master/docs/html/index.html

# Use nginx's default page
RUN mv public public-old \
    && mkdir public \
    && chown -R nginx:nginx public \
    && curl -L $NGINX_DEFAULT -o public/index.html
giautm commented 3 years ago

@kleisauke : Hi, I don't want to break compatibility for anyone. But, I think weserv should have a base image with default Nginx (for production ready) and the module weserv only.

The current image ghcr.io/weserv/images:5.x can be re-created based on that.

kleisauke commented 3 years ago

@giautm Ah, I think I misunderstood your question. Are you referring to dynamic nginx modules? If so, I'm currently working on that in our weserv/rpms repository, see the nginx-mod-weserv branch. This allows users to install nginx and the weserv module with just dnf install nginx nginx-mod-weserv on RHEL 9 (and its derivatives).

This can be tested with this Dockerfile:

Details ```dockerfile FROM rockylinux:9 # Set default timezone (can be overridden with -e "TZ=Continent/City") ENV TZ=Europe/Amsterdam # Update packages RUN dnf update -y \ # Install needed RPM repos and dependencies && dnf install -y epel-release \ && crb enable \ && dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm \ && dnf config-manager --set-enabled remi \ # Add Weserv's RPM repository for RHEL 9 (and its derivatives) && dnf config-manager --add-repo https://rpms.wsrv.nl/weserv.repo \ # Install nginx and the weserv module && dnf install -y --setopt=tsflags=nodocs nginx nginx-mod-weserv \ # Minimal config to get the weserv module running && echo -e "location / {\nresolver 1.1.1.1;\nweserv proxy;\n}" > /etc/nginx/default.d/weserv.conf EXPOSE 80 STOPSIGNAL SIGQUIT CMD ["nginx", "-g", "daemon off;"] ```

Edit: updated for use with RHEL 9 (and its derivatives).

kleisauke commented 3 years ago

I hope this information helped. Please feel free to re-open with more details if further assistance is required.