Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added python2 by conda #150

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ ONBUILD COPY . $APP_SOURCE_DIR

# install all dependencies, build app, clean up
ONBUILD RUN cd $APP_SOURCE_DIR && \
$BUILD_SCRIPTS_DIR/install-deps.sh && \
$BUILD_SCRIPTS_DIR/install-node.sh && \
$BUILD_SCRIPTS_DIR/install-phantom.sh && \
$BUILD_SCRIPTS_DIR/install-graphicsmagick.sh && \
$BUILD_SCRIPTS_DIR/install-mongo.sh && \
$BUILD_SCRIPTS_DIR/install-meteor.sh && \
$BUILD_SCRIPTS_DIR/build-meteor.sh && \
$BUILD_SCRIPTS_DIR/post-build-cleanup.sh
bash -l $BUILD_SCRIPTS_DIR/install-deps.sh && \
bash -l $BUILD_SCRIPTS_DIR/install-node.sh && \
bash -l $BUILD_SCRIPTS_DIR/install-phantom.sh && \
bash -l $BUILD_SCRIPTS_DIR/install-graphicsmagick.sh && \
bash -l $BUILD_SCRIPTS_DIR/install-mongo.sh && \
bash -l $BUILD_SCRIPTS_DIR/install-meteor.sh && \
bash -l $BUILD_SCRIPTS_DIR/build-meteor.sh && \
bash -l $BUILD_SCRIPTS_DIR/post-build-cleanup.sh

# Default values for Meteor environment variables
ENV ROOT_URL http://localhost
Expand All @@ -74,4 +74,4 @@ WORKDIR $APP_BUNDLE_DIR/bundle

# start the app
ENTRYPOINT ["./entrypoint.sh"]
CMD ["node", "main.js"]
CMD ["node", "main.js"]
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[![Circle CI](https://circleci.com/gh/jshimko/meteor-launchpad/tree/master.svg?style=svg)](https://circleci.com/gh/jshimko/meteor-launchpad/tree/master)
# Meteor Launchpad - Base Docker Image for Meteor Apps

Works for Meteor 2 and 3.

### Build

Add the following to a `Dockerfile` in the root of your app:
Expand Down Expand Up @@ -67,23 +69,24 @@ Here are examples of both methods of setting custom options for your build:

To use any of them, create a `launchpad.conf` in the root of your app and add any of the following values.

```sh
```dotenv
# launchpad.conf

# Use apt-get to install any additional dependencies
# that you need before your building/running your app
# (default: undefined)
APT_GET_INSTALL="curl git wget"

# Install a custom Node version (default: latest 8.x)
NODE_VERSION=8.9.0
# Install a custom Node version (default: latest 20.x)
NODE_VERSION=20.10.0

# Installs the latest version of each (default: all false)
INSTALL_MONGO=true
INSTALL_PHANTOMJS=true
INSTALL_GRAPHICSMAGICK=true
```


**Option #2 - Docker Build Args**

If you prefer not to have a config file in your project, your other option is to use the Docker `--build-arg` flag. When you build your image, you can set any of the same values above as a build arg.
Expand Down Expand Up @@ -159,7 +162,7 @@ docker-compose up -d

## Custom Builds of Meteor Launchpad

If you'd like to create a custom build for some reason, you can use the `build.sh` script in the root of the project to run all of the necessary commands.
If you'd like to create a custom build for some reason, you can use the `build.sh` script in the root of the project to run all the necessary commands.

First, make any changes you want, then to create your custom build:

Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ IMAGE_NAME=${1:-"jshimko/meteor-launchpad"}

printf "\n[-] Building $IMAGE_NAME...\n\n"

docker build -f dev.dockerfile -t $IMAGE_NAME:devbuild .
docker build -t $IMAGE_NAME:latest .
docker build --no-cache -f dev.dockerfile -t $IMAGE_NAME:devbuild .
docker build --no-cache -t $IMAGE_NAME:latest .
1 change: 1 addition & 0 deletions dev.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ONBUILD ENV APT_GET_INSTALL $APT_GET_INSTALL
ONBUILD ARG NODE_VERSION
ONBUILD ENV NODE_VERSION ${NODE_VERSION:-14.17.4}


ONBUILD ARG INSTALL_MONGO
ONBUILD ENV INSTALL_MONGO ${INSTALL_MONGO:-true}

Expand Down
24 changes: 23 additions & 1 deletion scripts/build-meteor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,31 @@ export METEOR_ALLOW_SUPERUSER=true

cd $APP_SOURCE_DIR

printf "\n[-] Activate conda in app directory...\n\n"

source /opt/conda/etc/profile.d/conda.sh

NODE_VERSION=$(node -v | cut -c2-)

echo "\nNODE_VERSION: ${NODE_VERSION}\n\n"

if [[ "$(echo "$NODE_VERSION" | cut -d'.' -f1)" -gt 14 ]]; then
PYTHON_VERSION=3.12.2
else
PYTHON_VERSION=2.7.18
fi

echo "\PYTHON_VERSION: ${PYTHON_VERSION}\n\n"

conda create --name py python=${PYTHON_VERSION} -y
conda activate py

echo "\n[-] Check python version on build...\n\n"
echo `python --version`

# Install app deps
printf "\n[-] Running npm install in app directory...\n\n"
meteor npm install
meteor npm ci

# build the bundle
printf "\n[-] Building Meteor application...\n\n"
Expand Down
16 changes: 14 additions & 2 deletions scripts/install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,22 @@ if [ -f $APP_SOURCE_DIR/launchpad.conf ]; then
fi
fi

apt-get install -y --no-install-recommends curl bzip2 libarchive-tools build-essential python git wget gnupg2 dirmngr
apt-get install -y --no-install-recommends curl bzip2 libarchive-tools build-essential git wget gpg gnupg2 dirmngr

### Conda

# install gosu
# Install our public GPG key to trusted store
curl https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > conda.gpg
install -o root -g root -m 644 conda.gpg /usr/share/keyrings/conda-archive-keyring.gpg

# Check whether fingerprint is correct (will output an error message otherwise)
gpg --keyring /usr/share/keyrings/conda-archive-keyring.gpg --no-default-keyring --fingerprint 34161F5BF5EB1D4BFBBB8F0A8AEB4F8B29D82806

# Add our Debian repo
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" > /etc/apt/sources.list.d/conda.list

apt-get update
apt-get install -y conda

dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"

Expand Down
2 changes: 1 addition & 1 deletion scripts/post-build-cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rm -rf /opt/nodejs/bin/npm
rm -rf /opt/nodejs/lib/node_modules/npm/

# remove os dependencies
apt-get purge -y --auto-remove apt-transport-https build-essential libarchive-tools bzip2 ca-certificates curl git python
apt-get purge -y --auto-remove apt-transport-https build-essential libarchive-tools bzip2 ca-certificates curl git wget gpg gnupg2 dirmngr conda
apt-get -y autoremove
apt-get -y clean
apt-get -y autoclean
Expand Down