forked from reactioncommerce/reaction
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathreaction.prod.docker
More file actions
116 lines (97 loc) · 3.23 KB
/
reaction.prod.docker
File metadata and controls
116 lines (97 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
############################################################
# Builds a Meteor + Reaction + MongoDB Docker Image
#
# Important: Best to run from a clean directory that hasn't had meteor run in it.
# Important: packages/<pkg>/.npm and .build* should not exist
#
# NOTE: this script has some reaction specific scripts,
# you probably don't want to use this a generic dockerfile
#
# Usage:
# Build:
# docker build -t <your org>/reaction .
#
# Run Reaction, Meteor + local mongo:
#
# docker run -d -p 80:80
# -e ROOT_URL="http://localhost" \
# -e REACTION_EMAIL="youradmin@yourdomain.com" \
# -e REACTION_USER="admin" \
# -e REACTION_AUTH="password" \
# -t <your org>/reaction
#
#
# Optional Meteor parameters (-e):
#
# ROOT_URL="< hostname>"
# MONGO_URL="<your mongodb connect string>"
# MONGO_OPLOG_URL="<mongo oplog url>"
# PORT="<meteor port>"
# METEOR_SETTINGS="{json}"
#
# Reaction Specific parameter (-e):
#
# MAIL_URL="<smtp connection string>"
# REACTION_EMAIL="youradmin@yourdomain.com"
# REACTION_USER="admin"
# REACTION_AUTH="password"
#
##############################################################
FROM debian:jessie
MAINTAINER Aaron Judd <hello@reactioncommerce.com>
ENV DEV_BUILD "false"
ENV NODE_VERSION "0.10.41"
# Install PhantomJS
ENV INSTALL_PHANTOMJS "true"
ENV PHANTOMJS_VERSION "2.1.3"
# Install MongoDB
ENV INSTALL_MONGO "false"
ENV MONGO_MAJOR "2.6"
ENV MONGO_VERSION "2.6.11"
# Meteor environment variables
ENV PORT "80"
ENV ROOT_URL "http://localhost"
ENV MONGO_URL "mongodb://127.0.0.1:27017/meteor"
ENV PACKAGE_DIRS "packages"
# setup server timezone
# also set timezone to Europe/Zurich in Reaction backend. not sure if that had any effect.
# probably not. but restarting Reaction after these commands in the shell DID have an effect!
#
RUN apt-get --assume-yes install --reinstall tzdata
ENV TZ "Europe/Zurich"
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN dpkg-reconfigure -f noninteractive tzdata
# build script directories
ENV APP_SOURCE_DIR "/var/src"
ENV APP_BUNDLE_DIR "/var/www"
ENV BUILD_SCRIPTS_DIR "/opt/reaction"
# Install entrypoint and build scripts
COPY bin/clone-packages.sh /opt/reaction/clone-packages.sh
COPY docker/scripts $BUILD_SCRIPTS_DIR
RUN chmod -R +x $BUILD_SCRIPTS_DIR
RUN echo 'installing deps'
RUN bash $BUILD_SCRIPTS_DIR/install-deps.sh
RUN echo 'installing mongodb'
RUN bash $BUILD_SCRIPTS_DIR/install-mongodb.sh
RUN echo 'installing node'
RUN bash $BUILD_SCRIPTS_DIR/install-node.sh
RUN echo 'installing phantom'
RUN bash $BUILD_SCRIPTS_DIR/install-phantom.sh
# copy the app to the container, build it, cleanup
COPY . $APP_SOURCE_DIR
RUN echo 'installing meteor'
RUN bash $BUILD_SCRIPTS_DIR/install-meteor.sh
RUN echo 'installed meteor'
RUN echo 'cloning packages and building meteor app'
RUN cd $APP_SOURCE_DIR && \
bash $BUILD_SCRIPTS_DIR/clone-packages.sh && \
bash $BUILD_SCRIPTS_DIR/build-meteor.sh && \
bash $BUILD_SCRIPTS_DIR/post-build-cleanup.sh
RUN echo 'done building'
# switch to production meteor bundle
WORKDIR $APP_BUNDLE_DIR/bundle
# 80 is the default meteor production port, while 3000 is development mode
EXPOSE 80
# start mongo and reaction
ENTRYPOINT ["./entrypoint.sh"]
CMD []