FriendlyCaptcha / friendly-lite-server

Lite server for Friendly Captcha
https://friendlycaptcha.com
Other
43 stars 12 forks source link

Set Permission in docker file #18

Closed Max-Haedicke-AX closed 9 months ago

Max-Haedicke-AX commented 9 months ago

After the Copy of the Public folder, it would be possible to set the correct Permissions like

COPY ./public /var/www/html
COPY ./src /var/www/src

#Set Permissions
RUN chmod -R 755 /var/www/html
amenk commented 9 months ago

What's the issue / advantage?

Max-Haedicke-AX commented 9 months ago

I did not set any rights and worked as root user. The server was started, but it could not read the php file.

So I set the correct permissions in the Dockerfile and now it works.

This line always ensures that the correct permissions are set for the folder or files in the container

I had this permissions

-rw-r----- 1 max max  359  2. Feb 07:52 puzzle.php
-rw-r----- 1 max max 1182  2. Feb 07:52 siteverify.php

there is a read missing :)

It's just a suggestion, if you don't want the customization that's okay with me too. Just close the issue.

amenk commented 9 months ago

How did you start the container?

I guess the change would not do any harm - feel free to make a pull request.

PS: The Dockerfile was originally contributed by @R0Wi - do you have comments?

R0Wi commented 9 months ago

In terms of file permissions (since we're using a php8.2-apache-based image), user www-data should always be able to read files under /var/www/html and /var/www/src from inside of the running container. To make sure the permissions are always matching the containers environment, I added the proper --chown directives in https://github.com/FriendlyCaptcha/friendly-lite-server/pull/19. See also https://docs.docker.com/engine/reference/builder/#copy

amenk commented 9 months ago

Fixed in 0.2.1 thank you all!