Skip to content

Commit 3c20487

Browse files
committed
create an image for nginx and add Docker instructions
1 parent d6cc539 commit 3c20487

File tree

5 files changed

+40
-8
lines changed

5 files changed

+40
-8
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,26 @@ $ curl -F "file=@./image.jpg" http://localhost:3000/
2929
```
3030
$ curl -X POST -d "{\"image\": \"xxxxxx-xxxx-xxxx-xxxx-xxxxxx.jpg\", \"filter\": \"sepia\"}" http://localhost:3000/
3131
```
32+
33+
## Docker
34+
35+
### Build Images
36+
37+
```
38+
$ docker build upload -t micro-upload
39+
$ docker build preview -t micro-preview
40+
$ docker build save -t micro-save
41+
$ docker build nginx -t micro-nginx
42+
```
43+
44+
or run
45+
46+
```
47+
$ ./build-images.sh
48+
```
49+
50+
## Run with `docker-compose`
51+
52+
```
53+
$ docker-compose up -d
54+
```

build-images.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
docker build upload -t micro-upload
4+
docker build preview -t micro-preview
5+
docker build save -t micro-save
6+
docker build nginx -t micro-nginx

docker-compose.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
11
version: "2"
22
services:
33
web:
4-
image: nginx
4+
image: micro-nginx
55
links:
66
- upload
77
- preview
88
- save
99
ports:
1010
- "8000:80"
11-
volumes:
12-
- ./microservices.conf:/etc/nginx/conf.d/microservices.conf
13-
command: [nginx, '-g', 'daemon off;']
14-
1511
upload:
16-
build: ./upload
12+
image: micro-upload
1713
environment:
1814
- AWS_ACCESS_KEY=${AWS_ACCESS_KEY}
1915
- AWS_SECRET_KEY=${AWS_SECRET_KEY}
2016
preview:
21-
build: ./preview
17+
image: micro-preview
2218
environment:
2319
- AWS_ACCESS_KEY=${AWS_ACCESS_KEY}
2420
- AWS_SECRET_KEY=${AWS_SECRET_KEY}
2521
save:
26-
build: ./save
22+
image: micro-save
2723
environment:
2824
- AWS_ACCESS_KEY=${AWS_ACCESS_KEY}
2925
- AWS_SECRET_KEY=${AWS_SECRET_KEY}

nginx/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM nginx:latest
2+
3+
COPY microservices.conf /etc/nginx/conf.d/microservices.conf
4+
5+
EXPOSE 80
6+
7+
CMD [ "nginx", "-g", "daemon off;" ]
File renamed without changes.

0 commit comments

Comments
 (0)