From 692f5fb10c60f8b933c3fbcfd549c5db2f9b7058 Mon Sep 17 00:00:00 2001 From: Stephen Moloney Date: Tue, 17 Jan 2017 08:49:42 +0000 Subject: locally build docker image --- Dockerfile | 76 +++++++++++++++++++++++++++++++++++++++++++++++++----- docker-compose.yml | 66 +++++++++++++++++++++++++++-------------------- 2 files changed, 108 insertions(+), 34 deletions(-) diff --git a/Dockerfile b/Dockerfile index 591d8ca2..7dea33ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,71 @@ -FROM meteorhacks/meteord:onbuild -MAINTAINER Maxime Quandalle +FROM debian:wheezy +MAINTAINER wefork -# Run as you wish! -# docker run -d --name wekan-db mongo -# docker run -d --link "wekan-db:db" -e "MONGO_URL=mongodb://db" \ -# -e "ROOT_URL=http://example.com" -p 8080:80 mquandalle/wekan +ENV BUILD_DEPS="wget curl bzip2 build-essential python git" +ARG NODE_VERSION=v0.10.48 +ARG METEOR_RELEASE=1.3.5.1 +ARG NPM_VERSION=3.10.10 +ARG ARCHICTECTURE=linux-x64 +ARG SRC_PATH=./ + +# Copy the app to the image +COPY ${SRC_PATH} ./app + +# OS dependencies +RUN apt-get update -y && apt-get install -y ${BUILD_DEPS} + +# Download nodejs +RUN wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-${ARCHICTECTURE}.tar.gz && \ + wget https://nodejs.org/dist/${NODE_VERSION}/SHASUMS256.txt.asc + +# Verify nodejs authenticity +RUN \ + grep ${NODE_VERSION}-${ARCHICTECTURE}.tar.gz SHASUMS256.txt.asc | shasum -a 256 -c - && \ + gpg --keyserver pool.sks-keyservers.net --recv-keys 9554F04D7259F04124DE6B476D5A82AC7E37093B && \ + gpg --keyserver pool.sks-keyservers.net --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 && \ + gpg --keyserver pool.sks-keyservers.net --recv-keys FD3A5288F042B6850C66B31F09FE44734EB7990E && \ + gpg --keyserver pool.sks-keyservers.net --recv-keys 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 && \ + gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D && \ + gpg --keyserver pool.sks-keyservers.net --recv-keys C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 && \ + gpg --keyserver pool.sks-keyservers.net --recv-keys B9AE9905FFD7803F25714661B63B535A4C206CA9 && \ + gpg --refresh-keys pool.sks-keyservers.net && \ + gpg --verify SHASUMS256.txt.asc + +# Install Node +RUN \ + tar xvzf node-${NODE_VERSION}-${ARCHICTECTURE}.tar.gz && \ + rm node-${NODE_VERSION}-${ARCHICTECTURE}.tar.gz && \ + mv node-${NODE_VERSION}-${ARCHICTECTURE} /opt/nodejs && \ + ln -s /opt/nodejs/bin/node /usr/bin/node && \ + ln -s /opt/nodejs/bin/npm /usr/bin/npm + +# Install Node dependencies +RUN npm install npm@${NPM_VERSION} -g && \ + npm install -g node-gyp && \ + npm install -g fibers + +# Install meteor +RUN curl https://install.meteor.com -o ./install_meteor.sh && \ + sed -i "s|RELEASE=.*|RELEASE=${METEOR_RELEASE}\"\"|g" ./install_meteor.sh && \ + echo "Starting meteor ${METEOR_RELEASE} installation... \n" && \ + sh ./install_meteor.sh + +# Build app +RUN cd ./app && \ + meteor npm install --save xss && \ + echo "Starting meteor build of the app... \n" && \ + meteor build --directory /opt/app_build && \ + cd /opt/app_build/bundle/programs/server/ && \ + npm install && \ + mv /opt/app_build/bundle /build && \ + cd /build + +# Cleanup +RUN \ + apt-get remove --purge -y ${BUILD_DEPS} && \ + rm -R /var/lib/apt/lists/* /app /opt/app_build ~/.meteor && \ + rm /install_meteor.sh + +ENV PORT=80 + +CMD ["node", "/build/main.js"] diff --git a/docker-compose.yml b/docker-compose.yml index b9f02a48..029106e6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,31 +1,41 @@ -# You can read the Docker Compose documentation at: -# -# https://docs.docker.com/compose/ -# -# Run with file with `docker-compose up -d`. -# -# We use two separate Docker containers: one for the database and one for the -# Wekan application. The Wekan container doensn’t contain any mutable state -# (all the user data, even uploads, are saved in the database) so updating it -# is as simple as stoping the old version and starting the new one. If you want -# to update the database you need to uncomment the volume section below. +version: '2' -wekandb: - image: mongo -# volumes: -# - ./data/runtime/db:/data/db -# - ./data/dump:/dump - command: mongod --smallfiles --oplogSize 128 - ports: - - 27017 +services: -wekan: - image: mquandalle/wekan - links: - - wekandb - environment: - - MONGO_URL=mongodb://wekandb/wekan - - ROOT_URL=http://localhost:80 - ports: - - 80:80 + wekandb: + image: mongo:latest + container_name: wekan-db + restart: always + command: mongod --smallfiles --oplogSize 128 + expose: + - 27017 + volumes: + - wekan-db:/data/db + - wekan-db-dump:/dump + wekan: + image: wefork/wekan + container_name: wekan-app + restart: always + build: + context: . + dockerfile: Dockerfile + args: + - node_version=${NODE_VERSION} + - meteor_release=${METEOR_RELEASE} + - npm_version=${NPM_VERSION} + - architecture=${ARCHITECTURE} + - src_path=${SRC_PATH} + ports: + - 80:80 + environment: + - MONGO_URL=mongodb://wekandb:27017/wekan + - ROOT_URL=http://localhost + links: + - wekandb + depends_on: + - wekandb + +volumes: + wekan-db: + driver: local -- cgit v1.2.3-1-g7c22 From 250650f46af30f1219e77155b76457aa57f5839a Mon Sep 17 00:00:00 2001 From: Stephen Moloney Date: Tue, 17 Jan 2017 16:45:11 +0000 Subject: change to mongo 3.4 --- docker-compose.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 029106e6..35318ed0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,10 +3,12 @@ version: '2' services: wekandb: - image: mongo:latest + image: mongo:3.4 container_name: wekan-db restart: always command: mongod --smallfiles --oplogSize 128 + networks: + - wekan-tier expose: - 27017 volumes: @@ -17,6 +19,8 @@ services: image: wefork/wekan container_name: wekan-app restart: always + networks: + - wekan-tier build: context: . dockerfile: Dockerfile @@ -31,11 +35,15 @@ services: environment: - MONGO_URL=mongodb://wekandb:27017/wekan - ROOT_URL=http://localhost - links: - - wekandb depends_on: - wekandb volumes: wekan-db: driver: local + wekan-db-dump: + driver: local + +networks: + wekan-tier: + driver: bridge -- cgit v1.2.3-1-g7c22