Skip to content
Snippets Groups Projects
Commit 92bfae4b authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

docker-compose: add a build.sh script which automates the setup

* Create the user in the image with the same UID than the host user.
  This makes it easier to share files between the host and the container.
* Install the PHP dependencies right away, so the user doesn't have to
  know anything about composer at the beginning.
parent 4c990add
No related branches found
No related tags found
No related merge requests found
Pipeline #13865 passed
......@@ -6,6 +6,8 @@ the symfony app.
## Setup
* `sudo apt install docker-compose` to install docker-compose on Debian/Ubuntu
* `sudo ./build.sh` - to build the docker images and install the PHP dependencies
* `sudo docker-compose up` - to run the server: http://127.0.0.1:8000
## Running the Server
......@@ -17,7 +19,7 @@ the symfony app.
## Executing Symfony commands
* `./run` to start a shell in the php-fpm container.
* `./run.sh` to start a shell in the php-fpm container.
* After this you can run symfony/composer commands like:
* `./bin/console debug:config`
* `composer install`
......
#!/bin/bash
# We need to creat the user inside the container with the same ID as the host user
docker-compose build --build-arg "UID=${SUDO_UID:-$UID}"
# Install dependencies
docker-compose run --rm --entrypoint composer php-fpm install
\ No newline at end of file
......@@ -38,7 +38,8 @@ RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
STOPSIGNAL SIGQUIT
RUN useradd -u 1000 -ms /bin/bash user
ARG UID
RUN useradd -u "$UID" -ms /bin/bash user
RUN echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER user
......
#!/bin/sh
#!/bin/bash
docker-compose run --rm --entrypoint bash php-fpm
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment