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
|
# Dockerfile for json-server
|
||||||
#
|
#
|
||||||
|
|
||||||
FROM alpine
|
FROM alpine:3
|
||||||
MAINTAINER kev <noreply@easypi.pro>
|
MAINTAINER EasyPi Software Foundation
|
||||||
|
|
||||||
WORKDIR /data
|
|
||||||
|
|
||||||
RUN set -xe \
|
RUN set -xe \
|
||||||
&& apk add --no-cache nodejs nodejs-npm \
|
&& apk add --no-cache nodejs nodejs-npm \
|
||||||
&& npm install -g json-server \
|
&& npm install -g json-server \
|
||||||
&& rm -rf /tmp/npm* /var/cache/apk/*
|
&& rm -rf /tmp/npm* /var/cache/apk/*
|
||||||
|
|
||||||
|
WORKDIR /data
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
ENTRYPOINT ["json-server"]
|
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
|
## docker-compose.yml
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
json-server:
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
json-server:
|
||||||
image: vimagick/json-server
|
image: vimagick/json-server
|
||||||
command: -H 0.0.0.0 -p 3000 -w db.json
|
command: -H 0.0.0.0 -p 3000 -w db.json
|
||||||
|
init: true
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/data
|
- ./data:/data
|
||||||
restart: always
|
restart: unless-stopped
|
||||||
```
|
```
|
||||||
|
|
||||||
|
>> :warning: `init: true` is required. [read more][2]
|
||||||
|
|
||||||
## data/db.json
|
## data/db.json
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@ -48,3 +53,4 @@ http GET :3000/db
|
|||||||
```
|
```
|
||||||
|
|
||||||
[1]: https://github.com/typicode/json-server
|
[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:
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
json-server:
|
||||||
image: vimagick/json-server
|
image: vimagick/json-server
|
||||||
command: -H 0.0.0.0 -p 3000 -w db.json
|
command: -H 0.0.0.0 -p 3000 -w db.json
|
||||||
|
init: true
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/data
|
- ./data:/data
|
||||||
restart: always
|
restart: unless-stopped
|
||||||
|
Loading…
Reference in New Issue
Block a user