# |
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 |
# |
May 10th 2021, 17:35 |
tyler.adam.lazenby |
This is honestly the first time I have used docker ... at all. I am just trying to get a ci going on my gitlab that can check my phpunit tests. |
# |
May 10th 2021, 17:34 |
kevin.pfeifer |
do you use this custom image in a docker-compose.yml? |
# |
May 10th 2021, 17:32 |
slackebot |
https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer COPY . /var/www WORKDIR /var/www RUN composer update``` |
# |
May 10th 2021, 17:32 |
tyler.adam.lazenby |
```FROM php:8.0-apache RUN apt-get update -y andand apt-get install -y libwebp-dev libjpeg62-turbo-dev libpng-dev libxpm-dev \ libfreetype6-dev RUN apt-get update andand \ apt-get install -y \ zlib1g-dev RUN apt-get update andand \ apt-get install -y \ libicu-dev libonig-dev libzip-dev RUN apt-get install git -y RUN docker-php-ext-install mbstring mysqli intl gd zip RUN curl -sS |
# |
May 10th 2021, 17:32 |
tyler.adam.lazenby |
I don't know if this applies here, but what should I do next in this Dockerfile to get it to expose the server and get it to run on my localhost on port 8081? |
# |
May 10th 2021, 15:22 |
paolo.bragagni |
@ndm done, thanks |
# |
May 10th 2021, 15:04 |
val |
thanks |