Last active
September 2, 2016 10:14
-
-
Save lanmower/2918af4b0e50eaa8afb446f9bfecc456 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
APPNAME=<%= appName %> | |
APP_PATH=/opt/$APPNAME | |
BUNDLE_PATH=$APP_PATH/current | |
ENV_FILE=$APP_PATH/config/env.list | |
PORT=<%= port %> | |
# Remove previous version of the app, if exists | |
docker rm -f $APPNAME | |
# Remove frontend container if exists | |
docker rm -f $APPNAME-frontend | |
# We don't need to fail the deployment because of a docker hub downtime | |
set +e | |
docker pull <%= image %> | |
docker build -t abernix/meteord:app - << EOF | |
FROM abernix/meteord:base | |
RUN apt-get install graphicsmagick -y | |
RUN apt-get install wget -y | |
RUN wget https://raw.githubusercontent.com/notDavid/full-ffmpeg-in-debian-wheezy/master/buildffmpeg.sh -O /tmp/ffmpeg.sh | |
RUN chmod +x /tmp/ffmpeg.sh | |
RUN /tmp/ffmpeg.sh | |
VOLUME ["/store/cfs"] | |
EOF | |
set -e | |
docker run \ | |
-d \ | |
--restart=always \ | |
--publish=$PORT:80 \ | |
--volume=$BUNDLE_PATH:/bundle \ | |
--volume=/store/files:/bundle/cfs/files \ | |
--hostname="$HOSTNAME-$APPNAME" \ | |
--env-file=$ENV_FILE \ | |
<% if(useLocalMongo) { %>--link=mongodb:mongodb --env=MONGO_URL=mongodb://mongodb:27017/$APPNAME <% } %>\ | |
<% if(logConfig && logConfig.driver) { %>--log-driver=<%= logConfig.driver %> <% } %>\ | |
<% for(var option in logConfig.opts) { %>--log-opt <%= option %>=<%= logConfig.opts[option] %> <% } %>\ | |
<% for(var volume in volumes) { %>-v <%= volume %>:<%= volumes[volume] %> <% } %>\ | |
--name=$APPNAME \ | |
abernix/meteord:base | |
<% if(typeof sslConfig === "object") { %> | |
# We don't need to fail the deployment because of a docker hub downtime | |
set +e | |
docker pull meteorhacks/mup-frontend-server:latest | |
set -e | |
docker run \ | |
-d \ | |
--restart=always \ | |
--volume=/opt/$APPNAME/config/bundle.crt:/bundle.crt \ | |
--volume=/opt/$APPNAME/config/private.key:/private.key \ | |
--link=$APPNAME:backend \ | |
--publish=<%= sslConfig.port %>:443 \ | |
--name=$APPNAME-frontend \ | |
meteorhacks/mup-frontend-server /start.sh | |
<% } %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment