Skip to content

Commit d382524

Browse files
committed
docs(docker): add docker releated thing
1 parent ca5ac6f commit d382524

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

docker-compose.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: '3.8'
2+
services:
3+
db:
4+
image: postgres:12
5+
environment:
6+
POSTGRES_USER: postgres
7+
POSTGRES_PASSWORD: 0
8+
POSTGRES_DB: postgres
9+
ports:
10+
- 5432:5432
11+
volumes:
12+
- ./data:/var/lib/postgresql/data
13+
pgadmin:
14+
image: dpage/pgadmin4
15+
environment:
16+
PGADMIN_DEFAULT_EMAIL: '[email protected]'
17+
PGADMIN_DEFAULT_PASSWORD: '000000'
18+
ports:
19+
- 9099:80
20+
depends_on:
21+
- db
22+
restful:
23+
image: guzhongren/deno-restful-api-with-pg
24+
environment:
25+
DB_HOST: db
26+
ports:
27+
- 8000:8000
28+
links:
29+
- db
30+
depends_on:
31+
- db
32+
restart: on-failure

dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM hayd/alpine-deno:1.2.0 as builder
2+
LABEL maintainer="[email protected]"
3+
WORKDIR /app
4+
COPY deps.ts /app
5+
RUN deno cache deps.ts
6+
ADD . /app
7+
RUN deno cache ./deps.ts
8+
RUN deno bundle src/index.ts ./platform.js
9+
10+
11+
FROM hayd/alpine-deno:1.2.0
12+
ENV TZ "Asia/Shanghai"
13+
WORKDIR /root/
14+
COPY --from=builder /app/platform.js .
15+
EXPOSE 8000
16+
# RUN deno run --allow-net --allow-env ./platform.js
17+
ENTRYPOINT [ "deno", "run", "--allow-net", "--allow-env", "./platform.js" ]

makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,10 @@ updateDeps:
1818
deno cache --lock=lock.json --lock-write ./deps.ts
1919

2020
cache:
21-
deno cache -r --lock=lock.json ./deps.ts
21+
deno cache -r --lock=lock.json ./deps.ts
22+
23+
dockerfile:
24+
docker build -t guzhongren/deno-restful-api-with-pg .
25+
26+
docker-compose:
27+
docker-compose up -d

0 commit comments

Comments
 (0)