diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..d23b55d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git +vendor \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f0aaaf7 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "intelephense.environment.phpVersion": "8.1.0" +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 95d7801..9ebdf8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Release Notes +## v4.1.0 (2025-06-18) +💻 Added Docker to the project + ## v4.0.1 (2025-01-18) - 🐛 Bug fix with incorrect days in a year diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5efcad7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM php:8.1-cli + +# unzip and git are needed for composer to run +RUN apt-get update && apt-get install -y \ + unzip \ + git \ + && rm -rf /var/lib/apt/lists/* + +# Install Composer binary +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +WORKDIR /app + +# Copy composer files first for better cache usage +COPY composer.json composer.lock* ./ + +# Install all the dependencies and clear cache +RUN composer install --no-interaction --prefer-dist --no-progress && \ + composer clear-cache + +# Copy the rest of the application +COPY . . + +ENTRYPOINT [ "bash" ] \ No newline at end of file diff --git a/README.md b/README.md index 9eb1f71..feffe5a 100644 --- a/README.md +++ b/README.md @@ -27,3 +27,20 @@ composer require serhii/ago ## License The Ago project is licensed under the [MIT License](https://github.com/php-ago/ago/blob/master/LICENSE) + +## Development +### Without Docker +You'll need to have Composer and PHP installed on your machine + +### Docker +#### Build an image +To build an image, navigate to the root of project that contains `Dockerfile` and run this command: +```bash +docker compose build app +``` + +#### Run the container +To run the container, navigate to the root of project that contains `Dockerfile` and run this command: +```bash +docker compose run --rm app +``` \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..08b0631 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +name: php-serhii-ago + +services: + app: + build: + context: . + image: php-serhii-ago + volumes: + - .:/app + environment: + - TERM=xterm-256color + tty: true + stdin_open: true