mirror of
https://github.com/vimagick/dockerfiles.git
synced 2024-12-25 02:04:06 +02:00
fix json-server (FIX #187)
This commit is contained in:
parent
c95a77645a
commit
345bbc1996
@ -2,16 +2,16 @@
|
||||
# Dockerfile for json-server
|
||||
#
|
||||
|
||||
FROM alpine
|
||||
MAINTAINER kev <noreply@easypi.pro>
|
||||
|
||||
WORKDIR /data
|
||||
FROM alpine:3
|
||||
MAINTAINER EasyPi Software Foundation
|
||||
|
||||
RUN set -xe \
|
||||
&& apk add --no-cache nodejs nodejs-npm \
|
||||
&& npm install -g json-server \
|
||||
&& rm -rf /tmp/npm* /var/cache/apk/*
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENTRYPOINT ["json-server"]
|
||||
|
@ -8,16 +8,21 @@ Get a full fake REST API with zero coding in less than 30 seconds (seriously) wi
|
||||
## docker-compose.yml
|
||||
|
||||
```yaml
|
||||
json-server:
|
||||
image: vimagick/json-server
|
||||
command: -H 0.0.0.0 -p 3000 -w db.json
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./data:/data
|
||||
restart: always
|
||||
version: "3.8"
|
||||
services:
|
||||
json-server:
|
||||
image: vimagick/json-server
|
||||
command: -H 0.0.0.0 -p 3000 -w db.json
|
||||
init: true
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./data:/data
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
||||
>> :warning: `init: true` is required. [read more][2]
|
||||
|
||||
## data/db.json
|
||||
|
||||
```json
|
||||
@ -48,3 +53,4 @@ http GET :3000/db
|
||||
```
|
||||
|
||||
[1]: https://github.com/typicode/json-server
|
||||
[2]: https://developpaper.com/avoid-running-nodejs-as-pid-1-under-the-docker-image/
|
||||
|
@ -1,8 +1,11 @@
|
||||
json-server:
|
||||
image: vimagick/json-server
|
||||
command: -H 0.0.0.0 -p 3000 -w db.json
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./data:/data
|
||||
restart: always
|
||||
version: "3.8"
|
||||
services:
|
||||
json-server:
|
||||
image: vimagick/json-server
|
||||
command: -H 0.0.0.0 -p 3000 -w db.json
|
||||
init: true
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./data:/data
|
||||
restart: unless-stopped
|
||||
|
Loading…
Reference in New Issue
Block a user