Skip to content

Instantly share code, notes, and snippets.

@nhu313
Last active March 12, 2020 03:12
Show Gist options
  • Save nhu313/7c284e01faacd6b547e228437be4ae74 to your computer and use it in GitHub Desktop.
Save nhu313/7c284e01faacd6b547e228437be4ae74 to your computer and use it in GitHub Desktop.
FROM ruby:2.6.5-stretch as base
RUN apt-get update && apt-get install -y \
git \
build-essential \
g++ \
libpq-dev \
qt4-dev-tools \
libqt4-dev \
nodejs
RUN mkdir -p /var/app
WORKDIR /var/app
COPY Gemfile Gemfile.lock ./
RUN bundle install
# Do I need this? I don't see base being used anywhere
FROM base as release
COPY . ./
EXPOSE 80
ENTRYPOINT bundle exec rails s -p 80 -b 0.0.0.0
@nhu313
Copy link
Author

nhu313 commented Mar 12, 2020

# build environment
FROM node:13.10.1-alpine3.11 as build
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY package.json /app/package.json
RUN yarn install --silent
RUN yarn global add react-scripts@3.4.0
COPY . /app
RUN yarn run build

# production environment
FROM nginx:1.17.9-alpine
COPY --from=build /app/build /usr/share/nginx/html
ENV NODE_ENV production
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment