Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
FROM node:6.9
EXPOSE 80
EXPOSE 25

ENV PORT 80
EXPOSE ${PORT}

ENV NODE_ENV development

ENV TOWNSHIP_SECRET "some secret string here"
ENV DATADIR /data
VOLUME /data
VOLUME ${DATADIR}

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
RUN npm install --production --loglevel warn
RUN npm install --production --loglevel warn
COPY . /usr/src/app
RUN npm run build-js-prod && npm run build-css && npm run minify && npm run version
RUN npm run build-js-prod \
&& npm run build-css \
&& npm run minify \
&& npm run version

# make it possible to use the image by default
COPY config/default.js config/config.development.js

# do docker exec: npm run database

CMD npm run database && DEBUG=dat-registry npm run server
CMD npm run database \
&& DEBUG=dat-registry npm run server
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ services:
build: .
image: datproject/datbase:${TAG}
ports:
- 25:25
expose:
- 80
- 8888:80
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 8888 here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah - no good reason I guess

environment:
- NODE_ENV=${NODE_ENV}
volumes:
Expand Down
41 changes: 41 additions & 0 deletions docker-swarm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: '3.4'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give a tldr on this file or how to use it (maybe add to readme)? Not familiar with docker-swarm.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup

# start a swarm stack by running
# docker stack up -c docker-swarm.yml dat
#
# Requires a docker swarm with traefik running on an externally connectable `infra_traefik` network
# see https://github.com/onaci/swarm-infra
services:
datbase:
build: .
image: datproject/datbase:${TAG:-master}
environment:
- NODE_ENV=${NODE_ENV}
- TOWNSHIP_SECRET
- DATA=/data
volumes:
- data:/data
configs:
- source: datbase_config
target: /usr/src/app/config/config.development.js
networks:
default:
aliases:
- datbase.${STACKDOMAIN:-loc.alho.st}
infra_traefik:
deploy:
labels:
- "traefik.docker.network=infra_traefik"
# http://datbase.${STACKDOMAIN:-loc.alho.st}/
- "traefik.datbase.port=80"
- "traefik.datbase.frontend.rule=Host: datbase.${STACKDOMAIN:-loc.alho.st}"

networks:
infra_traefik:
external: true

volumes:
data:

configs:
datbase_config:
file: ./config/default.js
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"devDependencies": {
"dat-node": "^3.5.0",
"marked": "^0.3.6",
"nodemon": "^1.10.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'd like to keep this in devDependencies b/c its pretty big dependency. Why do you want to move it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved it entirely because the existing Dockerfile and docker image (with the CMD as is) fail to start without it.

"request": "^2.79.0",
"rimraf": "^2.5.4",
"standard": "^7.1.2",
Expand Down Expand Up @@ -102,6 +101,7 @@
"node-sass": "^3.8.0",
"node-sass-magic-importer": "^0.1.4",
"node-version-assets": "^1.1.0",
"nodemon": "^1.10.0",
"pretty-bytes": "^3.0.1",
"pump": "^1.0.2",
"range-parser": "^1.2.0",
Expand Down