Skip to content

Commit

Permalink
Merge pull request #16 from udx/UAT-68
Browse files Browse the repository at this point in the history
Changed workdir to /var/www
  • Loading branch information
fqjony authored Jan 17, 2025
2 parents fcea80d + dbe89b3 commit 1ea4073
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
mkdir -p /var/log/php /var/log/nginx /run/php /tmp /var/lib/nginx/body && \
touch /var/log/php/fpm.log && \
chown -R "${USER}:${USER}" /var/log/php /var/log/nginx /run/php /tmp /var/lib/nginx /var/www/html && \
chmod -R 755 /var/log/php /var/log/nginx /run/php /tmp /var/lib/nginx /var/www/html
chown -R "${USER}:${USER}" /var/log/php /var/log/nginx /run/php /tmp /var/lib/nginx /var/www && \
chmod -R 755 /var/log/php /var/log/nginx /run/php /tmp /var/lib/nginx /var/www

# Copy NGINX and PHP configurations
COPY etc/nginx/nginx.conf /etc/nginx/nginx.conf
Expand All @@ -53,8 +53,8 @@ RUN sed -i "s|^error_log =.*|error_log = /var/log/php/fpm.log|" /etc/php/"${PHP_
chown -R "${USER}:${USER}" /var/log/php/fpm.log

# Copy application source
COPY src/index.html /var/www/html/index.html
RUN chmod 644 /var/www/html/index.html
COPY src/index.html /var/www/index.html
RUN chmod 644 /var/www/index.html

# Copy entrypoint script and set permissions
COPY ./bin/start-nginx.sh /usr/local/bin/start-nginx.sh
Expand All @@ -69,6 +69,6 @@ USER "${USER}"

# Set volumes, working directory, and default command
VOLUME [ "/var/www", "/home/${USER}" ]
WORKDIR /var/www/html
WORKDIR /var/www

CMD ["tail", "-f", "/dev/null"]
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ build:
run: clean
@echo "Running Docker container $(if $(INTERACTIVE),in interactive mode,for testing)..."
@docker run $(if $(INTERACTIVE),-it --entrypoint $(CMD),-d) --rm --name $(CONTAINER_NAME) \
-v $(CURDIR)/$(SRC_PATH):$(CONTAINER_SRC_PATH) -p $(HOST_PORT):$(CONTAINER_PORT) \
$(DOCKER_IMAGE) $(if $(INTERACTIVE),,$(CMD))
-p $(HOST_PORT):$(CONTAINER_PORT) \
$(DOCKER_IMAGE)
@$(MAKE) wait-container-ready

# Deploy application with the pulled Docker Hub image and user-provided app code
deploy: clean
@echo "Deploying PHP application..."
@docker run -d --rm --name $(CONTAINER_NAME) \
-v $(CURDIR)/$(SRC_PATH):/var/www/html \
-v $(CURDIR)/$(SRC_PATH):/var/www \
-p $(HOST_PORT):80 \
$(DOCKER_IMAGE)
$(DOCKER_IMAGE) $(CMD)
@echo "Application is accessible at http://localhost:$(HOST_PORT)"
@$(MAKE) wait-container-ready

Expand Down
2 changes: 1 addition & 1 deletion Makefile.variables
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ PHP_VERSION := 8.3

# Paths
SRC_PATH := src
CONTAINER_SRC_PATH := /var/www/html
CONTAINER_SRC_PATH := /var/www

# Specific test script name
TEST_SCRIPT := test.php
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ docker pull usabilitydynamics/udx-worker-php:latest

```
docker run -d --name my-php-app \
-v $(pwd)/my-php-app:/var/www/html \
-v $(pwd)/my-php-app:/var/www \
-p 80:80 \
usabilitydynamics/udx-worker-php:latest
```
Expand Down Expand Up @@ -97,7 +97,7 @@ APP_PATH=/path/to/your-php-app make deploy
```

- Replace `/path/to/your-php-app` with the path to your PHP application directory.
- This command will mount your specified application directory into the container’s `/var/www/html` directory, allowing you to run your custom application directly.
- This command will mount your specified application directory into the container’s `/var/www` directory, allowing you to run your custom application directly.

## Configuration

Expand Down
2 changes: 1 addition & 1 deletion etc/nginx/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ server {
listen 80;
server_name localhost;

root /var/www/html;
root /var/www;
index index.php index.html index.htm;

# Dynamic content funneled through index.php
Expand Down
2 changes: 1 addition & 1 deletion src/tests/40_file_write_test.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$testFile = "/var/www/html/test_write.txt";
$testFile = "/var/www/test_write.txt";
if (file_put_contents($testFile, "Testing file write permissions") !== false) {
echo "File write test successful!";
unlink($testFile); // Cleanup
Expand Down

0 comments on commit 1ea4073

Please sign in to comment.