Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mikusg authored Nov 7, 2024
1 parent 63ea250 commit cf35380
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# The tag here should match the Meteor version of your app, per .meteor/release
FROM geoffreybooth/meteor-base:2.16

# Ensure Python and build tools are available (for cross-platform build)
RUN apt-get update && apt-get install -y python3 build-essential && \
meteor npm config set python python3

# Copy app package.json and package-lock.json into container
COPY ./app/package*.json $APP_SOURCE_FOLDER/

Expand All @@ -23,28 +19,40 @@ FROM node:14.21.0-alpine
ENV APP_BUNDLE_FOLDER=/opt/bundle
ENV SCRIPTS_FOLDER=/docker

# Runtime dependencies; if your dependencies need compilation (native modules such as bcrypt) or you are using Meteor <1.8.1, use app-with-native-dependencies.dockerfile instead
# Install OS build dependencies, which stay with this intermediate image but don’t become part of the final published image
RUN apk --no-cache add \
bash \
ca-certificates \
python3 \
build-base && \
npm config set python python3
bash \
g++ \
make \
python3

# Copy in entrypoint
COPY --from=0 $SCRIPTS_FOLDER $SCRIPTS_FOLDER/

# Copy in app bundle
COPY --from=0 $APP_BUNDLE_FOLDER/bundle $APP_BUNDLE_FOLDER/bundle/

# COPY ./app/private/jsons /opt/meteor/dist/bundle/private/jsons
# COPY ./app/private/jsons $APP_BUNDLE_FOLDER/bundle/private/jsons
# COPY ./app/private/jsons $APP_BUNDLE_FOLDER/bundle/programs/server/assets/app/jsons
RUN bash $SCRIPTS_FOLDER/build-meteor-npm-dependencies.sh --build-from-source

RUN bash $SCRIPTS_FOLDER/build-meteor-npm-dependencies.sh
# Start another Docker stage, so that the final image doesn’t contain the layer with the build dependencies
# See previous FROM line; this must match
FROM node:14.21.0-alpine

ENV APP_BUNDLE_FOLDER /opt/bundle

Check warning on line 41 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
ENV SCRIPTS_FOLDER /docker

Check warning on line 42 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

# Install OS runtime dependencies
RUN apk --no-cache add \
bash \
ca-certificates

# Copy in entrypoint with the built and installed dependencies from the previous image
COPY --from=1 $SCRIPTS_FOLDER $SCRIPTS_FOLDER/

# Copy in app bundle with the built and installed dependencies from the previous image
COPY --from=1 $APP_BUNDLE_FOLDER/bundle $APP_BUNDLE_FOLDER/bundle/

# Start app
ENTRYPOINT ["/docker/entrypoint.sh"]

CMD ["node", "main.js"]

0 comments on commit cf35380

Please sign in to comment.