# |
May 10th 2021, 17:48 |
kevin.pfeifer |
yea i haven't dealt with CI that closely till now ,:) |
# |
May 10th 2021, 17:47 |
slackebot |
MYSQL_ROOT_PASSWORD: secret # Run the phpunit tests All: script: - cp app.php - vendor/bin/phpunit``` |
# |
May 10th 2021, 17:47 |
tyler.adam.lazenby |
```image: name/ofimage # Cache the vendor folder cache: paths: - vendor/ before_script: # Install composer - curl -sS https://getcomposer.org/installer | php # Install all project dependencies - composer install services: - mysql variables: # Configure mysql service (https://hub.docker.com/_/mysql/) # We will need to use these in the app.php test datasource MYSQL_DATABASE: test_myapp |
# |
May 10th 2021, 17:46 |
tyler.adam.lazenby |
I will be installing composer post image import and vendor non cache in my ci |
# |
May 10th 2021, 17:46 |
kevin.pfeifer |
ah i see |
# |
May 10th 2021, 17:46 |
tyler.adam.lazenby |
Right, the idea with that isn't to test if the project would run in docker. I am just testing to make sure everything is ready so that composer can run |
# |
May 10th 2021, 17:45 |
kevin.pfeifer |
but i could be wrong |
# |
May 10th 2021, 17:45 |
kevin.pfeifer |
if you change something later then nothing will happen in the container |
# |
May 10th 2021, 17:45 |
kevin.pfeifer |
but i think your COPY inside the image only copys your project once while the image is being created |
# |
May 10th 2021, 17:45 |
kevin.pfeifer |
i haven't used docker in a while |
# |
May 10th 2021, 17:45 |
tyler.adam.lazenby |
I am currently running the first version to see what happens |
# |
May 10th 2021, 17:44 |
kevin.pfeifer |
```version: "3.8" services: web: container_name: my_web build: context: . dockerfile: docker/web/Dockerfile ports: # 'host:container' - '80:80' volumes: - myapp:/home/node/app``` |
# |
May 10th 2021, 17:44 |
tyler.adam.lazenby |
i see |
# |
May 10th 2021, 17:44 |
kevin.pfeifer |
if you add that to the docker-compose.yml like that |
# |
May 10th 2021, 17:43 |
kevin.pfeifer |
would map you `d:/ezbm/myapp` to the inside of the container on `/home/node/app` |
# |
May 10th 2021, 17:43 |
kevin.pfeifer |
``` volumes: - myapp:/home/node/app``` |
# |
May 10th 2021, 17:43 |
kevin.pfeifer |
you could also just create a volume mount |
# |
May 10th 2021, 17:42 |
kevin.pfeifer |
instead of copying the whole project while creating the image |
# |
May 10th 2021, 17:42 |
tyler.adam.lazenby |
thank you |
# |
May 10th 2021, 17:42 |
kevin.pfeifer |
because you docker-compose.yml lies in d:/ezbm/docker-compose.yml |
# |
May 10th 2021, 17:42 |
tyler.adam.lazenby |
thank you |
# |
May 10th 2021, 17:42 |
kevin.pfeifer |
2nd |
# |
May 10th 2021, 17:42 |
tyler.adam.lazenby |
or at `d:/ezbm/docker/web/Dockerfile |
# |
May 10th 2021, 17:41 |
tyler.adam.lazenby |
right, but just to clarify, that means that if my project is located at d:/ezbm it would be creating the file at `d:/docker/web/Dockerfile` |
# |
May 10th 2021, 17:41 |
kevin.pfeifer |
which is you custom docker image from above |
# |
May 10th 2021, 17:40 |
kevin.pfeifer |
you create the file `docker/web/Dockerfile` |
# |
May 10th 2021, 17:40 |
kevin.pfeifer |
and relative to that file |
# |
May 10th 2021, 17:40 |
kevin.pfeifer |
docker-compose.yml lies in the root of your project |
# |
May 10th 2021, 17:40 |
tyler.adam.lazenby |
and then create the docker-composer.yml file? |
# |
May 10th 2021, 17:39 |
tyler.adam.lazenby |
so then what you are saying is that I need to move this a directory `docker/web/Dockerfile` in my project? |
# |
May 10th 2021, 17:39 |
kevin.pfeifer |
creating that image takes quite long |
# |
May 10th 2021, 17:39 |
kevin.pfeifer |
thats normal |
# |
May 10th 2021, 17:39 |
tyler.adam.lazenby |
because it is taking my entire project into account |
# |
May 10th 2021, 17:39 |
tyler.adam.lazenby |
Right now I have the file just at my project root. It takes a LONG time to build the image. |
# |
May 10th 2021, 17:38 |
tyler.adam.lazenby |
right. I get that. |
# |
May 10th 2021, 17:38 |
kevin.pfeifer |
and as you can see you can define the ports in the docker-compose.yml file |
# |
May 10th 2021, 17:38 |
kevin.pfeifer |
and then run `docker-compose up` to start that |
# |
May 10th 2021, 17:37 |
kevin.pfeifer |
```version: "3.8" services: web: container_name: alfred_web build: context: . dockerfile: docker/web/Dockerfile ports: # 'host:container' - '80:80' networks: - frontend - backend volumes: - nfsmount:/var/www/html:cached``` |
# |
May 10th 2021, 17:37 |
kevin.pfeifer |
and then create a `docker-compose.yml`with this content |
# |
May 10th 2021, 17:36 |
kevin.pfeifer |
usually if you want to use a custom image (what you posted above) locally you would write a file in `docker/web/Dockerfile` with that content from above |
# |
May 10th 2021, 17:35 |
tyler.adam.lazenby |
But using phpstorm is making this a lot easier |