Skip to content

Commit

Permalink
build SF 6.4 and 7.0 images
Browse files Browse the repository at this point in the history
  • Loading branch information
Yosri Bahri committed Apr 5, 2024
1 parent 84195a7 commit 9f6e8ec
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 37 deletions.
12 changes: 12 additions & 0 deletions .docker/new-symfony.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

set -eu -o pipefail

directory="$1"

# Delete existing symfony project
rm -rf "$directory/symfony"
cd "$directory"

echo "Installation of symfony project with $SYMFONY_VERSION version"
symfony new symfony --no-git --version="$SYMFONY_VERSION"
12 changes: 8 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.1']
php: ['8.1', '8.2']
composer: ['2']
symfony: ['6.3']
symfony: ['6.4']
latest: [false]
include:
- php: 8.1
symfony: 7.0
composer: 2
latest: false
- php: 8.2
symfony: 6.3
symfony: 7.0
composer: 2
latest: true
name: "[Package] SF v${{ matrix.symfony }} PHP ${{ matrix.php }}"
Expand Down Expand Up @@ -77,7 +81,7 @@ jobs:
matrix:
php: ['8.1', '8.2']
composer: ['2']
symfony: ['6.3']
symfony: ['6.4', '7.0']
needs: packaging
runs-on: ubuntu-latest
name: "[Run] SF v${{ matrix.symfony }} PHP ${{ matrix.php }}"
Expand Down
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
ARG PHP_VERSION=8
ARG PHP_VERSION=8.2
ARG COMPOSER_VERSION=2

FROM composer:${COMPOSER_VERSION} as composer
FROM php:${PHP_VERSION}-fpm-alpine

ARG PHP_VERSION=8
ENV PHP_VERSION $PHP_VERSION
ARG COMPOSER_VERSION=2
ENV COMPOSER_VERSION $COMPOSER_VERSION
ARG SYMFONY_VERSION=6.2
ARG SYMFONY_VERSION=6.4
ENV SYMFONY_VERSION $SYMFONY_VERSION

COPY --from=composer /usr/bin/composer /usr/bin/composer
Expand All @@ -23,6 +21,9 @@ RUN apk add --no-cache icu-dev \
COPY .docker/docker-symfony-golden.ini /usr/local/etc/php/conf.d/
### END SYMFONY REQUIREMENT

COPY ./.docker/new-symfony.sh /usr/local/bin/new-symfony
RUN chmod +x /usr/local/bin/new-symfony

## SYMFONY CLI INSTALL
RUN apk add --no-cache bash git
RUN curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.alpine.sh' | bash
Expand All @@ -33,9 +34,7 @@ RUN apk add symfony-cli
HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD symfony check:req || exit 1
# END HEALTHCHECK

WORKDIR /var/www

RUN symfony new symfony --no-git --version="$SYMFONY_VERSION"
RUN new-symfony "/var/www"

WORKDIR /var/www/symfony

Expand Down
58 changes: 32 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,31 @@ List of docker images available by Symfony and PHP versions:
</thead>
<tbody>
<tr>
<td>7.0</td>
<td>8</td>
<td><i>Waiting for the version release</i></td>
<td rowspan="2">7.0</td>
<td>8.2</td>
<td>
<code>ghcr.io/devgine/symfony-golden:latest</code><br />
<code>ghcr.io/devgine/symfony-golden:v7.0-php8.2-alpine</code>
</td>
</tr>
<tr>
<td>6.4</td>
<td>8</td>
<td><i>Waiting for the version release</i></td>
<td>8.1</td>
<td><code>ghcr.io/devgine/symfony-golden:v7.0-php8.1-alpine</code></td>
</tr>
<tr>
<td rowspan="3">6.3</td>
<td>8.3</td>
<td><i>Waiting for the version release</i></td>
<td rowspan="2">6.4</td>
<td>8.2</td>
<td>
<code>ghcr.io/devgine/symfony-golden:latest</code><br />
<code>ghcr.io/devgine/symfony-golden:v6.4-php8.2-alpine</code>
</td>
</tr>
<tr>
<td>8.1</td>
<td><code>ghcr.io/devgine/symfony-golden:v6.4-php8.1-alpine</code></td>
</tr>
<tr>
<td rowspan="2">6.3</td>
<td>8.2</td>
<td>
<code>ghcr.io/devgine/symfony-golden:latest</code><br />
Expand All @@ -45,11 +55,7 @@ List of docker images available by Symfony and PHP versions:
<td><code>ghcr.io/devgine/symfony-golden:v6.3-php8.1-alpine</code></td>
</tr>
<tr>
<td rowspan="3">6.2</td>
<td>8.3</td>
<td><i>Waiting for the version release</i></td>
</tr>
<tr>
<td rowspan="2">6.2</td>
<td>8.2</td>
<td><code>ghcr.io/devgine/symfony-golden:v6.2-php8.2-alpine</code></td>
</tr>
Expand All @@ -58,11 +64,7 @@ List of docker images available by Symfony and PHP versions:
<td><code>ghcr.io/devgine/symfony-golden:v6.2-php8.1-alpine</code></td>
</tr>
<tr>
<td rowspan="3">6.1</td>
<td>8.3</td>
<td><i>Waiting for the version release</i></td>
</tr>
<tr>
<td rowspan="2">6.1</td>
<td>8.2</td>
<td><code>ghcr.io/devgine/symfony-golden:v6.1-php8.2-alpine</code></td>
</tr>
Expand All @@ -71,11 +73,7 @@ List of docker images available by Symfony and PHP versions:
<td><code>ghcr.io/devgine/symfony-golden:v6.1-php8.1-alpine</code></td>
</tr>
<tr>
<td rowspan="7">5.4</td>
<td>8.3</td>
<td><i>Waiting for the version release</i></td>
</tr>
<tr>
<td rowspan="6">5.4</td>
<td>8.2</td>
<td><code>ghcr.io/devgine/symfony-golden:v5.4-php8.2-alpine</code></td>
</tr>
Expand Down Expand Up @@ -107,10 +105,11 @@ List of docker images available by Symfony and PHP versions:
```shell
docker run --rm -ti -p 8000:8000 -v LOCAL_PROJETC_DIR:/var/www/symfony ghcr.io/devgine/symfony-golden:latest sh
```
> You can change latest with specific tag<br>
> You can change latest by a specific tag<br>
> [Available versions](https://github.com/devgine/symfony-golden-image/pkgs/container/symfony-golden/versions)
After the built-in server has been started, visit http://localhost:8000 in your web browser.
After the built-in, server will be started.<br>
Visit http://localhost:8000 in your web browser.

### Use as base image in Dockerfile
```dockerfile
Expand All @@ -134,6 +133,13 @@ services:
volumes:
- '.:/var/www/symfony'
```
Be careful, if you bind the symfony project as a volume the local directory will erase the symfony project.<br>
To fix that, after your service running you can launch the below command inside the container.
```bash
new-symfony $DIRECTORY
# example
new-symfony /var/www
```

## References

Expand Down

0 comments on commit 9f6e8ec

Please sign in to comment.