diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 73fc392..0000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,23 +0,0 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/php -{ - "name": "PHP", - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - // "image": "mcr.microsoft.com/devcontainers/php:1-8.2-bullseye", - "dockerComposeFile": "docker-compose.yml", - "service": "app", - "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, - // Configure tool-specific properties. - // "customizations": {}, - // Use 'forwardPorts' to make a list of ports inside the container available locally. - "forwardPorts": [ - 80, - 5050 - ] - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html" - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5860404 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "livePreview.serverRoot": "www", +} \ No newline at end of file diff --git a/.devcontainer/Dockerfile b/Dockerfile similarity index 62% rename from .devcontainer/Dockerfile rename to Dockerfile index 279fa17..b6be7bd 100644 --- a/.devcontainer/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ FROM php:apache +# Enable Apache mod_rewrite +RUN a2enmod rewrite + # Update package list RUN apt-get update @@ -8,4 +11,6 @@ RUN apt-get install -y git gnupg2 # Install PostgreSQL client and its PHP extensions RUN apt-get install -y libpq-dev \ - && docker-php-ext-install pdo pdo_pgsql \ No newline at end of file + && docker-php-ext-install pdo pdo_pgsql + +COPY ./www /var/www/html/ diff --git a/.devcontainer/docker-compose.yml b/docker-compose.yml similarity index 55% rename from .devcontainer/docker-compose.yml rename to docker-compose.yml index 2b46c44..3678cd9 100644 --- a/.devcontainer/docker-compose.yml +++ b/docker-compose.yml @@ -3,18 +3,28 @@ services: build: context: . dockerfile: Dockerfile - volumes: - - ../..:/workspaces:cached - command: sleep infinity + develop: + watch: + - action: sync + path: ./www + target: /var/www/html depends_on: - db + volumes: + - ./www:/var/www/html # Mount the local directory to the container + ports: + - "8080:80" db: image: postgres:latest environment: - POSTGRES_DB: test_database - POSTGRES_USER: db_user - POSTGRES_PASSWORD: db_password + POSTGRES_DB: db + POSTGRES_USER: user + POSTGRES_PASSWORD: password + expose: + - "5432" + volumes: + - database:/var/lib/postgresql/data pgadmin: image: dpage/pgadmin4:latest @@ -24,7 +34,7 @@ services: # Password for accessing pgAdmin 4 PGADMIN_DEFAULT_PASSWORD: adminpassword ports: - - "5050:5050" + - "8081:80" volumes: - pgadmin_data:/var/lib/pgadmin depends_on: @@ -32,4 +42,7 @@ services: restart: always volumes: - pgadmin_data: \ No newline at end of file + pgadmin_data: + database: + + diff --git a/test b/test deleted file mode 100644 index e69de29..0000000 diff --git a/test2 b/test2 deleted file mode 100644 index e69de29..0000000 diff --git a/www/first/index.html b/www/first/index.html new file mode 100644 index 0000000..5b8997e --- /dev/null +++ b/www/first/index.html @@ -0,0 +1,16 @@ + + + +
+ +