Custom Docker File

This topic provide you how create the docker image from DockerFile.

DockerFile

Create new empty file DockerFile.
Open it for edit with text editor.

Put inside this code:

FROM origam/server:master-latest AS base
COPY ["reverse-proxy.conf", "/etc/nginx/sites-available"]

Save It.
In this example i want to add into docker image configure script for setup Nginx.
This file have to be in same directory as DockerFile.

Run this :

docker build -t myownorigam:mytag -f Dockerfile .

This create the new docker image with the name myownorigam:mytag.

Now can i use this the new docker image for start the docker containder.

The Nginx server is include of docker image. Here below is set up nginx inside of docker.

reverse-proxy.conf

server {
    listen 80;
    listen [::]:80;

    access_log /var/log/nginx/reverse-access.log;
    error_log /var/log/nginx/reverse-error.log;

	proxy_read_timeout 360;
	proxy_connect_timeout 360;
	proxy_send_timeout 360;
	client_max_body_size 10M;

    location / {
	proxy_set_header   Host             $host;
	proxy_set_header   X-Real-IP        $remote_addr;
	proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_pass http://127.0.0.1:8080;
  }
}