Meteor Up Docker和Graphicsmagick [英] Meteor Up Docker and Graphicsmagick

查看:190
本文介绍了Meteor Up Docker和Graphicsmagick的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找如何在Meteor Up Docker上安装Graphicsmagick。



我发现了这个解决方案(在Docker内访问二进制程序)但是我无法做任何工作,我将这些行放在哪里? start.sh

  meteorDockerId = docker ps | grep meteorhacks / meteord:base | awk'{print $ 1}'
docker exec $ meteorDockerId apt-get install graphicsmagick -y

这是我的 start.sh

 #!/ bin / bash 

APPNAME = instagatas
APP_PATH = / opt / $ APPNAME
BUNDLE_PATH = $ APP_PATH /当前
ENV_FILE = $ APP_PATH / config / env.list
PORT = 80
USE_LOCAL_MONGO = 0

#删除以前版本的应用程序,如果存在
docker rm -f $ APPNAME

#删除前端容器如果存在
docker rm -f $ APPNAME-frontend

set -e
docker pull meteorhacks / meteord:base

if [$ USE_LOCAL_MONGO ==1];然后
docker运行\
-d \
--restart = always \
--publish = $ PORT:80 \
--volume = $ BUNDLE_PATH:/ bundle \
--env-file = $ ENV_FILE \
--link = mongodb:mongodb \
--hostname =$ HOSTNAME- $ APPNAME\\ \\
--env = MONGO_URL = mongodb:// mongodb:27017 / $ APPNAME \
--name = $ APPNAME \
meteorhacks / meteord:base
else
docker运行\
-d \
--restart = always \
--publish = $ PORT:80 \
--volume = $ BUNDLE_PATH :/ bundle \
--hostname =$ HOSTNAME- $ APPNAME\
--env-file = $ ENV_FILE \
--name = $ APPNAME \
meteorhacks / meteord:base
fi


docker pull meteorhacks / mup-frontend-server:latest
docker run \
-d \\ \\
--restart = always \
--volume = / opt / $ APPNAME / config / bundle.crt:/bundle.crt \
--volume = / opt / $ APPNAME /配置/ private.key:/private.key \
--link = $ APPNAME:backend \
--publish = 443:443 \
--name = $ APPNAME-frontend \\ \\
meteorhacks / mup-frontend-server /start.sh


解决方案

每次重新启动容器时,重新安装graphicsmagick软件包似乎是一个黑客,我不想做。



如果你是修改起始脚本,也可以使用一个Docker文件:

  FROM meteorhacks / meteord:base 
RUN apt-获取安装graphicsmagick -y

然后修改 start.sh 模板,使用graphicsmagick构建一个新的码头图像,并对其进行标记并使用该图像:



请参阅: https://gist.github.com/so0k/7d4be21c5e2d9abd3743/revisions



编辑:在哪里放Dockerfile?



start.sh templa te被复制到 / opt /< appName> / config / ,目前Dockerfile需要在同一目录( / opt / ; appName> / config / Dockerfile



请参阅 Linux初始化任务



另外可以指定具体Docker文件与 <$ c $的 -f 标志c> docker build



您的第三个选项是将Dockerfile管理到 docker build 使用此处的文档



我已经更新了 start.sh gist ,我们不再拖动meteord:base图像并建立它:

  docker build -t meteorhacks / met eord:app  - <<< EOF 
来自meteorhacks / meteord:base
运行apt-get install graphicsmagick -y
EOF

docker build 将每次运行,但只要要求不变,docker将使用它缓存的docker图像。 p>

I'm looking for how to install Graphicsmagick at Meteor Up Docker.

I found this solution (Access binaries inside docker) but I couldn't make work, where do I put those lines at start.sh?

meteorDockerId=docker ps | grep meteorhacks/meteord:base | awk '{print $1}'
docker exec $meteorDockerId apt-get install graphicsmagick -y

That's my start.sh:

#!/bin/bash

APPNAME=instagatas
APP_PATH=/opt/$APPNAME
BUNDLE_PATH=$APP_PATH/current
ENV_FILE=$APP_PATH/config/env.list
PORT=80
USE_LOCAL_MONGO=0

# remove previous version of the app, if exists
docker rm -f $APPNAME

# remove frontend container if exists
docker rm -f $APPNAME-frontend

set -e
docker pull meteorhacks/meteord:base

if [ "$USE_LOCAL_MONGO" == "1" ]; then
  docker run \
    -d \
    --restart=always \
    --publish=$PORT:80 \
    --volume=$BUNDLE_PATH:/bundle \
    --env-file=$ENV_FILE \
    --link=mongodb:mongodb \
    --hostname="$HOSTNAME-$APPNAME" \
    --env=MONGO_URL=mongodb://mongodb:27017/$APPNAME \
    --name=$APPNAME \
    meteorhacks/meteord:base
else
  docker run \
    -d \
    --restart=always \
    --publish=$PORT:80 \
    --volume=$BUNDLE_PATH:/bundle \
    --hostname="$HOSTNAME-$APPNAME" \
    --env-file=$ENV_FILE \
    --name=$APPNAME \
    meteorhacks/meteord:base
fi


  docker pull meteorhacks/mup-frontend-server:latest
  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=443:443 \
    --name=$APPNAME-frontend \
    meteorhacks/mup-frontend-server /start.sh

解决方案

Re-installing the graphicsmagick package every time you re-start the containers seems like a hack I wouldn't want to do.

If you're modifying the start script already, might as well use a Dockerfile:

FROM meteorhacks/meteord:base
RUN apt-get install graphicsmagick -y

Then modify start.sh template to build a new docker image with graphicsmagick, tag it and use that image instead:

see: https://gist.github.com/so0k/7d4be21c5e2d9abd3743/revisions

EDIT: Where to put Dockerfile?

start.sh template is copied to /opt/<appName>/config/, currently the Dockerfile would need to be in that same directory (/opt/<appName>/config/Dockerfile)

see Linux init Task

Alternatively, you can specify specific Dockerfile with the -f flag for the docker build

Or your third option is to pipe Dockerfile to docker build using a here document

I've updated the start.sh gist, we no longer pull the meteord:base image and build it instead:

docker build -t meteorhacks/meteord:app - << EOF
FROM meteorhacks/meteord:base
RUN apt-get install graphicsmagick -y
EOF

The docker build will run every time, but as long as the requirements aren't changing, docker will use the docker images it cached.

这篇关于Meteor Up Docker和Graphicsmagick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆