Skip to content

Instantly share code, notes, and snippets.

@afrokick
Created September 2, 2022 13:34
Show Gist options
  • Save afrokick/6f39acb116771456c0046baa89e921e7 to your computer and use it in GitHub Desktop.
Save afrokick/6f39acb116771456c0046baa89e921e7 to your computer and use it in GitHub Desktop.
Docker file for Meteor
FROM node:14.19.1-stretch-slim as base
ENV APP_DIR=/meteor
# Install as root (otherwise node-gyp gets compiled as nobody)
USER root
WORKDIR $APP_DIR/bundle/programs/server/
RUN apt-get update \
&& apt-get install -y --no-install-recommends g++ build-essential python \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Copy bundle and scripts to the image APP_DIR
ADD ./editor-app.tar.gz $APP_DIR
# Remove unused files to reduce image size
RUN find . -type f -name 'README.md' -delete \
&& find . -type f -name 'LICENSE' -delete \
&& find . -type f -name '*.d.ts' -delete \
&& rm -r ./npm/node_modules/meteor/babel-compiler/node_modules/typescript
# the install command for debian
RUN echo "Installing the node modules..." \
&& npm install -g node-gyp \
&& npm install --production --silent
FROM node:14.19.1-stretch-slim as app
ENV APP_DIR=/meteor
# Copy in app bundle
COPY --from=base $APP_DIR/bundle $APP_DIR/bundle/
# start the app
WORKDIR /meteor/bundle
CMD ["node","main.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment