Skip to content

Instantly share code, notes, and snippets.

@r3cha
Last active September 3, 2020 10:27
Show Gist options
  • Save r3cha/22243e3a73c70b5b558ed42663470e08 to your computer and use it in GitHub Desktop.
Save r3cha/22243e3a73c70b5b558ed42663470e08 to your computer and use it in GitHub Desktop.
One app docker image for build frontend & backend
FROM node:14-alpine as node
FROM ruby:2.7.0-alpine3.11 as build-base
COPY --from=node /usr/local/bin/node /usr/local/bin/
COPY --from=node /opt/yarn-v1.22.4 /opt/yarn-v1.22.4
RUN ln -s /usr/local/bin/node /usr/local/bin/nodejs
# Here is you can copy npm from node to build-base if you preffer use it
RUN ln -s /opt/yarn-v1.22.4/bin/yarn /usr/local/bin/yarn
RUN ln -s /opt/yarn-v1.22.4/bin/yarnpkg /usr/local/bin/yarnpkg
RUN node --version
RUN mkdir -p /app
WORKDIR /app
COPY . ./
# install app server deps
RUN gem update --system
RUN gem install bundler:2.1.4
RUN bundle config --global jobs $(nproc --all)
RUN bundle install
# install frontend deps
RUN yarn install
# optinal copy entrypoint inside image
# COPY docker/entrypoint.sh /usr/bin/
# RUN chmod +x /usr/bin/entrypoint.sh
# ENTRYPOINT ["entrypoint.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment