# |
May 10th 2021, 17:51 |
tyler.adam.lazenby |
My first real programming job (all others were freelance) I was thrown about 30 years of legacy code, projects, programs that didn't work, and I was asked I could fix it. Luckly the guy that owns the place is a former old time programmer (think cobolt) and when I flat out said no, he understood |
# |
May 10th 2021, 17:50 |
kevin.pfeifer |
so kudos to you :) |
# |
May 10th 2021, 17:49 |
kevin.pfeifer |
well then you are definitely an expectional programmer because I have inherited many projects in the past which didn't have any tests, documentation or anything like that |
# |
May 10th 2021, 17:49 |
tyler.adam.lazenby |
I want to leave a nice little framework they can plug right into and ensure things are running the way that they should |
# |
May 10th 2021, 17:48 |
tyler.adam.lazenby |
Haha, well Ci's are needed because I am planning on leaving the project and company some time in the moderate future. I don't want to leave developers hanging |
# |
May 10th 2021, 17:48 |
kevin.pfeifer |
but have tried docker |
# |
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. |