<commit_before># ============================================================================
# Base
# ============================================================================

FROM alpine:3.8 as base

RUN apk --no-cache add python3

WORKDIR /app


# ============================================================================
# Code
# ============================================================================

FROM base AS code

COPY ui/ ui/
COPY backend/ backend/
COPY run.sh run.sh

# ============================================================================
# Build
# ============================================================================

FROM base AS build

# Install packages
RUN apk --no-cache add \
    build-base \
    python3-dev \
    yarn

# Build Python packages
WORKDIR /app/backend

COPY --from=code /app/backend/requirements.txt .

RUN pip3 install -r requirements.txt

# Build JavaScript app
WORKDIR /app/ui

COPY --from=code /app/ui/package.json .
COPY --from=code /app/ui/yarn.lock .

RUN yarn

COPY --from=code /app/ui/ .

RUN yarn build


# ============================================================================
# Final
# ============================================================================

FROM base AS final

# Copy and install Python packages
COPY --from=build /usr/lib/python3.6/site-packages /usr/lib/python3.6/site-packages

# Copy code
COPY --from=code /app/ .
COPY --from=build /app/ui/build ui/build

EXPOSE 5000

CMD ["sh", "./run.sh"]<commit_msg>Separated Python and Javascript builds<commit_after># ============================================================================
# Base
# ============================================================================

FROM alpine:3.8 as base

RUN apk --no-cache add python3

WORKDIR /app


# ============================================================================
# Code
# ============================================================================

FROM base AS code

COPY ui/ ui/
COPY backend/ backend/
COPY run.sh run.sh

# ============================================================================
# Build Python
# ============================================================================

FROM base AS build_py

WORKDIR /app/backend

COPY --from=code /app/backend/requirements.txt .

RUN pip3 install -r requirements.txt


# ============================================================================
# Build JavaScript
# ============================================================================

FROM base AS build_js

RUN apk --no-cache add yarn

WORKDIR /app/ui

COPY --from=code /app/ui/package.json .
COPY --from=code /app/ui/yarn.lock .

RUN yarn

COPY --from=code /app/ui/ .

RUN yarn build


# ============================================================================
# Final
# ============================================================================

FROM base AS final

# Copy Python packages
COPY --from=build_py /usr/lib/python3.6/site-packages /usr/lib/python3.6/site-packages

# Copy code
COPY --from=code /app/ .
COPY --from=build_js /app/ui/build ui/build

EXPOSE 5000

CMD ["sh", "./run.sh"]
{'fraction_non_alphanumeric': 0.5063572790845519, 'fraction_numerical': 0.007946598855689765, 'mean_word_length': 5.515527950310559, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1711897', 'n_tokens_mistral': 830, 'n_tokens_neox': 696, 'n_words': 200}