Writing dockerfile

suggest change

Dockerfile is used to configure the custom image that we will be building with the web-application codes. Create a new file Dockerfile in the root folder of project and then put the following contents in the same

FROM php:7.0-apache
COPY /etc/php/php.ini /usr/local/etc/php/
COPY . /var/www/html/
EXPOSE 80

The first line is pretty straight forward and is used to describe which image should be used to build out new image. The same could be changed to any other specific version of PHP from the registry.

Second line is simply to upload php.ini file to our image. You can always change that file to some other custom file location.

The third line would copy the codes in current directory to /var/www/html which is our webroot. Remember /var/www/html inside the image.

The last line would simply open up port 80 inside the docker container.

Ignoring files

In some instances there might be some files that you don’t want on server like environment configuration etc. Let us assume that we have our environment in .env. Now in order to ignore this file, we can simply add it to .dockerignore in the root folder of our codebase.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Docker deployment:
* Writing dockerfile

Table Of Contents
2 Arrays
4 Types
10 Cookies
14 JSON
15 SOAP
17 cURL
19 XML
21 Traits
35 UTF-8
36 URLs
38 PHPDoc
41 Loops
44 Closur
72 YAML
77 Cache
78 Streams
81 PDO
82 SQLite3
83 Sockets
87 MongoDB
93 IMAP
94 Redis
95 Imagick
100 Docker deployment
102 APCu
108 PSR