Run project with docker compose
[asis23-votoe-client.git] / README.md
blobe06336af741f3d6243f3c1998cc9334f7b060d19
1 Use following command to serve client's html and assets with PHP.
3 ```bash
4 RESTAPI_HOST="rest.api.host.or.ip" \
5 RESTAPI_PORT="rest.api.port" \
6 php -S localhost:8080
7 ```
9 --------------------------------------------------------------------------------
11 Container Image
12 ---------------
14 Build (docker/container) image
16 ```bash
17 docker build --rm \
18     --tag 'edi2/client' \
19     .
20 ```
22 Run PHP server
24 ```bash
25 docker run --tty --interactive --rm \
26     --name edi2-client \
27     --publish 8080:80 \
28     --env RESTAPI_HOST='rest.api.host.or.ip' \
29     --env RESTAPI_PORT='rest.api.port' \
30     edi2/client
31 ```
33 --------------------------------------------------------------------------------
35 Access containers using domain names
36 ------------------------------------
38 Update **hosts** (`/etc/hosts`) file with [hostctl](https://github.com/guumaster/hostctl)
40 ```bash
41 sudo hostctl add domains edi2 api.vot.ar --ip "127.0.0.1"
42 sudo hostctl add domains edi2 www.vot.ar --ip "127.0.0.1"
43 ```
45 Manually run containers
47 ```bash
48 docker run --tty --interactive --rm \
49     --name nginx-proxy \
50     --publish 80:80 \
51     --volume /var/run/docker.sock:/tmp/docker.sock:ro \
52     nginxproxy/nginx-proxy:alpine
54 docker run --tty --interactive --rm \
55     --name edi2-server \
56     --env VIRTUAL_HOST='api.vot.ar' \
57     edi2/server
59 docker run --tty --interactive --rm \
60     --name edi2-client \
61     --env RESTAPI_HOST='api.vot.ar' \
62     --env RESTAPI_PORT='80' \
63     --env VIRTUAL_HOST='www.vot.ar' \
64     edi2/client
65 ```
67 --------------------------------------------------------------------------------
69 Docker Compose
70 --------------
72 Run the project using [docker compose](https://docs.docker.com/compose/)
74 ```bash
75 docker-compose up
76 ```
78 [Run at system startup](https://stackoverflow.com/a/53569049)
80 ```bash
81 sudo systemctl enable docker
82 docker-compose up --detach
83 ```