Skip to content

Instantly share code, notes, and snippets.

@mpapierski
Created March 13, 2019 10:36
Show Gist options
  • Save mpapierski/1b19c7903a4c489cb14e84615ec549c2 to your computer and use it in GitHub Desktop.
Save mpapierski/1b19c7903a4c489cb14e84615ec549c2 to your computer and use it in GitHub Desktop.
FROM python:3.7.2
# Build the code
WORKDIR /code
COPY . /code
# Compile source code into 'legacy' .pyc
RUN python -m compileall -b . && \
find . -iname "*.py" -delete
# Build dist
FROM node:lts
RUN apt-get update -q && apt-get install -y rubygems ruby-dev
RUN gem install bundle
COPY . /code
WORKDIR /code
RUN bundle install --path vendor/bundle
RUN yarn global add grunt-cli
RUN yarn
RUN grunt
# Final image
FROM python:3.7.2
RUN pip install pipenv
RUN apt-get -qq update && \
apt-get -q -y upgrade && \
apt-get install -y curl wget locales && \
rm -rf /var/lib/apt/lists/*
RUN sed -i "s/# pl_PL.*/pl_PL.UTF-8 UTF-8/g" /etc/locale.gen && \
# Ensure that we always use UTF-8 and with Canadian English locale
locale-gen pl_PL.UTF-8 && \
# Set up locales
echo 'LC_ALL=pl_PL.UTF-8\n\
LANG=pl_PL.UTF-8\n\
LC_CTYPE=pl_PL.UTF-8\n\
LC_COLLATE=pl_PL.UTF-8' > /etc/default/locale && \
chmod 0755 /etc/default/locale
ENV LC_ALL=pl_PL.UTF-8 \
LANG=pl_PL.UTF-8 \
LANGUAGE=pl_PL.UTF-8
COPY --from=0 /code /code
COPY --from=1 /code/dist /code/dist
WORKDIR /code
RUN pipenv install --deploy --system
EXPOSE 8080/tcp
CMD gunicorn -b 0.0.0.0:8080 foo.wsgi:application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment