locally build docker image

This commit is contained in:
Stephen Moloney 2017-01-17 08:49:42 +00:00
parent d619921d9c
commit 692f5fb10c
2 changed files with 108 additions and 34 deletions

View file

@ -1,7 +1,71 @@
FROM meteorhacks/meteord:onbuild
MAINTAINER Maxime Quandalle <mquandalle@wekan.io>
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"]

View file

@ -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 doensnt 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