Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit a47fde8

Browse files
author
Sven Dowideit
committed
Docker things I noticed trying to run my own dat registry
Signed-off-by: Sven Dowideit <[email protected]>
1 parent 2c2076e commit a47fde8

File tree

4 files changed

+58
-10
lines changed

4 files changed

+58
-10
lines changed

Dockerfile

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
11
FROM node:6.9
2-
EXPOSE 80
3-
EXPOSE 25
42

53
ENV PORT 80
4+
5+
EXPOSE ${PORT}
6+
EXPOSE 25
7+
68
ENV NODE_ENV development
79

810
ENV TOWNSHIP_SECRET "some secret string here"
911
ENV DATADIR /data
10-
VOLUME /data
12+
VOLUME ${DATADIR}
1113

1214
RUN mkdir -p /usr/src/app
1315
WORKDIR /usr/src/app
1416
COPY package.json /usr/src/app/
15-
RUN npm install --production --loglevel warn
17+
RUN npm install --production --loglevel warn
1618
COPY . /usr/src/app
17-
RUN npm run build-js-prod && npm run build-css && npm run minify && npm run version
19+
RUN npm run build-js-prod \
20+
&& npm run build-css \
21+
&& npm run minify \
22+
&& npm run version
23+
24+
# make it possible to use the image by default
25+
COPY config/default.js config/config.development.js
1826

1927
# do docker exec: npm run database
2028

21-
CMD npm run database && DEBUG=dat-registry npm run server
29+
CMD npm run database \
30+
&& DEBUG=dat-registry npm run server

docker-compose.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ services:
44
build: .
55
image: datproject/datbase:${TAG}
66
ports:
7-
- 25:25
8-
expose:
9-
- 80
7+
- 8888:80
108
environment:
119
- NODE_ENV=${NODE_ENV}
1210
volumes:

docker-swarm.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
version: '3.4'
2+
# start a swarm stack by running
3+
# docker stack up -c docker-swarm.yml dat
4+
#
5+
# Requires a docker swarm with traefik running on an externally connectable `infra_traefik` network
6+
# see https://github.com/onaci/swarm-infra
7+
services:
8+
datbase:
9+
build: .
10+
image: datproject/datbase:${TAG:-master}
11+
environment:
12+
- NODE_ENV=${NODE_ENV}
13+
- TOWNSHIP_SECRET
14+
- DATA=/data
15+
volumes:
16+
- data:/data
17+
configs:
18+
- source: datbase_config
19+
target: /usr/src/app/config/config.development.js
20+
networks:
21+
default:
22+
aliases:
23+
- datbase.${STACKDOMAIN:-loc.alho.st}
24+
infra_traefik:
25+
deploy:
26+
labels:
27+
- "traefik.docker.network=infra_traefik"
28+
# http://datbase.${STACKDOMAIN:-loc.alho.st}/
29+
- "traefik.datbase.port=80"
30+
- "traefik.datbase.frontend.rule=Host: datbase.${STACKDOMAIN:-loc.alho.st}"
31+
32+
networks:
33+
infra_traefik:
34+
external: true
35+
36+
volumes:
37+
data:
38+
39+
configs:
40+
datbase_config:
41+
file: ./config/default.js

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
"devDependencies": {
5656
"dat-node": "^3.5.0",
5757
"marked": "^0.3.6",
58-
"nodemon": "^1.10.0",
5958
"request": "^2.79.0",
6059
"rimraf": "^2.5.4",
6160
"standard": "^7.1.2",
@@ -102,6 +101,7 @@
102101
"node-sass": "^3.8.0",
103102
"node-sass-magic-importer": "^0.1.4",
104103
"node-version-assets": "^1.1.0",
104+
"nodemon": "^1.10.0",
105105
"pretty-bytes": "^3.0.1",
106106
"pump": "^1.0.2",
107107
"range-parser": "^1.2.0",

0 commit comments

Comments
 (0)