dina
dina

Reputation: 4289

dockerfile for running meteor app - using node:7.5.0-alpine

I am trying to run a meteor app on docker.

here is my Dockerfile:

From node:7.5.0-alpine
RUN meteor npm install --a
CMD ["meteor"]

running:

➜ docker build . -t myapp
Sending build context to Docker daemon 21.91 MB
Step 1 : FROM node:7.5.0-alpine
 ---> 0895ecd79009
Step 2 : RUN meteor npm install --a
 ---> Running in 1de3ba593bb1
/bin/sh: meteor: not found
The command '/bin/sh -c meteor npm install --a' returned a non-zero code: 127

this is the error received:

/bin/sh: meteor: not found

The command '/bin/sh -c meteor npm install --a' returned a non-zero

what did I do wrong?

basically I'm trying to create my image using a light weight meteor Base Image (node:7.5.0-alpine)

what should be fixed in my dockerfile?

Upvotes: 2

Views: 1187

Answers (2)

dina
dina

Reputation: 4289

I ended using martinezko/alpine-meteor image

Dockerfile

FROM martinezko/alpine-meteor
ENV NODE_ENV=production

running docker-build.sh to build it:

#!/bin/sh

set -e

# get the image tag
echo -n "Enter release tag [e.g. 1.0.7] "
read TAG
echo "You release has an amazing tag: $TAG"

REGISTRY=us.gcr.io
CONTAINER=my-com/my-app
BUILD_DIR=`pwd`/.build                      # <-- This is where meteor build your files.
                                            #     Folder will be created and after build will be deleted


echo "Start building container ${CONTAINER} ..."

# clean old build if exist
rm   -rf $BUILD_DIR
mkdir -p $BUILD_DIR

# install node packages
meteor npm install --a &&

# build meteor app
meteor build --directory $BUILD_DIR --architecture=os.linux.x86_64 --server-only &&

# pull fresh base image:
docker pull martinezko/alpine-meteor:latest &&

# build container
docker build --rm -t ${REGISTRY}/${CONTAINER}:${TAG} . &&


echo "${REGISTRY}/${CONTAINER}:${TAG}"
# push to our registry
echo "we are now pushing your amazing relese to google container engine registry $REGISTRY/$CONTAINER:$TAG"
docker push ${REGISTRY}/${CONTAINER}:${TAG}


# clean images if needed
# docker rmi -f ${CONTAINER}:${TAG} ${REGISTRY}/${CONTAINER}:${TAG} martinezko/alpine-meteor:latest

# to run your container
# docker run -d ${REGISTRY}/${CONTAINER}:${TAG}
# OR use docker-compose.yaml file
# docker-compose up -d

# clean build folder
rm -rf .build

echo "End build of container ${CONTAINER} ..."

Upvotes: 0

faigy langsam
faigy langsam

Reputation: 2176

You have to install meteor first, node is not enough.
try adding something like:
RUN curl "https://install.meteor.com/" | /bin/sh
at the 2nd line.
This is an example for a dockerfile for mongo based on a node image.

Upvotes: 1

Related Questions