Skip to content

Instantly share code, notes, and snippets.

@xavierpriour
Created May 7, 2018 15:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xavierpriour/5362feb8580cde43723758a7eaacc274 to your computer and use it in GitHub Desktop.
Save xavierpriour/5362feb8580cde43723758a7eaacc274 to your computer and use it in GitHub Desktop.
meteor-in-docker production - Dockerfile
# Dockerfile for DEPLOYED version
# (dev version uses assetsagacity/meteor-do),
# with bundled application code embedded in the image.
#
# It must be run with **bundled app folder** as the context, not project root.
# we need a first container to install project dependencies,
# as these require compiler tools and we do not want to pollute final image with them
# (and we can't use livedev for that as it is NOT alpine-based...)
FROM mhart/alpine-node:8 AS alpine-builder
RUN apk add --no-cache make gcc g++ python sudo git bzip2
RUN adduser -D -h /home/user user
ADD ./bundle /home/user
RUN chown -R user /home/user
WORKDIR /home/user
USER user
RUN cd programs/server && npm install --production
# then we build the final image,
# running the code that was setup previously
# (we can't use a base-# tag, as they do not support native modules like our bcrypt)
FROM mhart/alpine-node:8
RUN adduser -D -h /home/user user
COPY --from=alpine-builder /home/user /home/user
RUN chown -R user /home/user
WORKDIR /home/user
USER user
ARG BUILD_ID
ARG BUILD_TS
ENV BUILD_ID=${BUILD_ID} BUILD_TS=${BUILD_TS}
ENV PORT=3000
CMD ["node", "main.js"]
EXPOSE 3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment