Skip to content

Commit

Permalink
Merge branch 'master' into AliroGPT
Browse files Browse the repository at this point in the history
  • Loading branch information
jay-m-dev committed Jul 27, 2023
2 parents e9f62b7 + e2ab85b commit 7c8c1d2
Show file tree
Hide file tree
Showing 17 changed files with 176 additions and 955 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
# Leave this set to 0 on the GitHub repo so the unit and
# integration tests do not need to have wheels (until we
# find a convenient way to use wheels on GitHub)
TAG=0.20.a0
TAG=1.0.a0
USE_WHEELS=1
2 changes: 2 additions & 0 deletions docker-compose-int-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ services:
build:
context: .
dockerfile: docker/lab/Dockerfile
target: ${DOCKER_BUILD_ENV}
args:
# - USE_WHEELS=${USE_WHEELS}
- USE_WHEELS=0
Expand All @@ -47,6 +48,7 @@ services:
build:
context: .
dockerfile: docker/machine/Dockerfile
target: ${DOCKER_BUILD_ENV}
args:
# - USE_WHEELS=${USE_WHEELS}
- USE_WHEELS=0
Expand Down
21 changes: 21 additions & 0 deletions docker-compose-multi-machine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ services:
build:
context: .
dockerfile: docker/lab/Dockerfile
target: ${DOCKER_BUILD_ENV}
args:
- USE_WHEELS=${USE_WHEELS}
tty: true
stdin_open: true
volumes:
Expand All @@ -24,6 +27,9 @@ services:
build:
context: .
dockerfile: docker/machine/Dockerfile
target: ${DOCKER_BUILD_ENV}
args:
- USE_WHEELS=${USE_WHEELS}
tty: true
stdin_open: true
volumes:
Expand All @@ -43,6 +49,9 @@ services:
build:
context: .
dockerfile: docker/machine/Dockerfile
target: ${DOCKER_BUILD_ENV}
args:
- USE_WHEELS=${USE_WHEELS}
tty: true
stdin_open: true
volumes:
Expand All @@ -62,6 +71,9 @@ services:
build:
context: .
dockerfile: docker/machine/Dockerfile
target: ${DOCKER_BUILD_ENV}
args:
- USE_WHEELS=${USE_WHEELS}
tty: true
stdin_open: true
volumes:
Expand All @@ -81,6 +93,9 @@ services:
build:
context: .
dockerfile: docker/machine/Dockerfile
target: ${DOCKER_BUILD_ENV}
args:
- USE_WHEELS=${USE_WHEELS}
tty: true
stdin_open: true
volumes:
Expand All @@ -99,6 +114,9 @@ services:
build:
context: .
dockerfile: docker/machine/Dockerfile
target: ${DOCKER_BUILD_ENV}
args:
- USE_WHEELS=${USE_WHEELS}
tty: true
stdin_open: true
volumes:
Expand All @@ -118,6 +136,9 @@ services:
build:
context: .
dockerfile: docker/machine/Dockerfile
target: ${DOCKER_BUILD_ENV}
args:
- USE_WHEELS=${USE_WHEELS}
tty: true
stdin_open: true
volumes:
Expand Down
6 changes: 4 additions & 2 deletions docker-compose-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ services:
lab:
build:
context: .
dockerfile: docker/lab/Dockerfile_production
dockerfile: docker/lab/Dockerfile
target: prod
image: "aliro_lab:${TAG}"
tty: true
stdin_open: true
Expand All @@ -25,7 +26,8 @@ services:
machine:
build:
context: .
dockerfile: docker/machine/Dockerfile_production
dockerfile: docker/machine/Dockerfile
target: prod
image: "aliro_machine:${TAG}"
tty: true
stdin_open: true
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ services:
build:
context: .
dockerfile: docker/lab/Dockerfile
target: dev
args:
- USE_WHEELS=${USE_WHEELS}
tty: true
Expand All @@ -25,6 +26,7 @@ services:
build:
context: .
dockerfile: docker/machine/Dockerfile
target: dev
args:
- USE_WHEELS=${USE_WHEELS}
tty: true
Expand Down
80 changes: 63 additions & 17 deletions docker/lab/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Stage 1: Build and compile dependencies
FROM python:3.7.16-slim-buster AS builder
FROM python:3.7.16-slim-buster as base

ARG USE_WHEELS
ARG wheel_directory=docker/wheels
Expand Down Expand Up @@ -42,10 +42,6 @@ RUN if [ ${USE_WHEELS} -eq 1 ] ; \
fi
RUN rm /root/wheel/*.whl

# # These requirements need to be built, using wheels throws errors
# COPY ${docker_filepath}/requirements-build.txt /root/
# RUN pip install --no-cache-dir -r /root/requirements-build.txt

## Webserver
RUN rm /etc/apache2/sites-enabled/*
COPY ${docker_filepath}/ports.conf /etc/apache2/
Expand Down Expand Up @@ -75,19 +71,19 @@ COPY lab/package-lock.json /appsrc/lab/
RUN dos2unix /appsrc/lab/*.json
RUN npm install --silent --progress=false

# Stage 2: Final runtime image
FROM python:3.7.16-slim-buster
# Stage 2a: build dev version of lab
FROM python:3.7.16-slim-buster as dev

ARG docker_filepath=docker/lab/files

# Copy installed packages from the builder stage
COPY --from=builder /usr/local /usr/local
COPY --from=base /usr/local /usr/local

# Copy Apache configuration
COPY --from=builder /etc/apache2 /etc/apache2
COPY --from=base /etc/apache2 /etc/apache2

# Copy webapp and lab source code
COPY --from=builder /appsrc/lab /appsrc/lab
COPY --from=base /appsrc/lab /appsrc/lab

# Copy scripts and other files
COPY ${docker_filepath}/start.sh /root/
Expand All @@ -113,13 +109,6 @@ RUN apt-get update && apt-get install -y dos2unix git build-essential && \
apt-get autoremove -y && \
apt-get clean && \
chmod +x /root/*.sh
# rm -rf /src/scikit-surprise
# RUN cp '/etc/profile.d/.env' '/etc/profile.d/tag.sh'
# RUN dos2unix /etc/profile.d/tag.sh
# RUN sed -i "s/TAG=/export TAG=/g" /etc/profile.d/tag.sh

# Clean up
# RUN apt-get remove -y wget xz-utils

# Expose ports and set working directory
EXPOSE 5080
Expand All @@ -131,3 +120,60 @@ CMD ["/bin/bash", "/root/start.sh"]
# Entrypoint
ENTRYPOINT ["/root/entrypoint.sh"]

# Stage 2b: build prod version of lab
FROM python:3.7.16-slim-buster as prod
ARG docker_filepath=docker/lab/files

# Copy src for lab
COPY lab /appsrc/lab
COPY ai /appsrc/ai

# Copy installed packages from the builder stage
COPY --from=base /usr/local /usr/local

# Copy Apache configuration
COPY --from=base /etc/apache2 /etc/apache2

# Copy webapp and lab source code
COPY --from=base /appsrc/lab /appsrc/lab

# Copy scripts and other files
COPY ${docker_filepath}/start.sh /root/
COPY ${docker_filepath}/wait-for-it.sh /root/
COPY ${docker_filepath}/entrypoint.sh /root/
COPY ${docker_filepath}/001-pennai.conf /etc/apache2/sites-enabled/
COPY ${docker_filepath}/htpasswd /etc/apache2/htpasswd
COPY ${docker_filepath}/certs/* /usr/lib/ssl/private/
COPY .env /etc/profile.d/

# These requirements need to be built, using wheels throws errors
COPY ${docker_filepath}/requirements-build.txt /root/

# Copy knowledgebases
COPY 'data/knowledgebases/sklearn-benchmark-data-knowledgebase-r6.tsv.gz' /appsrc/data/knowledgebases/
COPY 'data/knowledgebases/pmlb_classification_metafeatures.csv.gz' /appsrc/data/knowledgebases/
COPY 'data/knowledgebases/pmlb_regression_results.pkl.gz' /appsrc/data/knowledgebases/
COPY 'data/knowledgebases/pmlb_regression_metafeatures.csv.gz' /appsrc/data/knowledgebases/

# Set version and build environment
ENV BUILD_ENV='prod'
RUN apt-get update && apt-get install -y dos2unix git build-essential && \
pip install --no-cache-dir -r /root/requirements-build.txt && \
cp '/etc/profile.d/.env' '/etc/profile.d/tag.sh' && \
dos2unix /etc/profile.d/tag.sh && \
sed -i "s/TAG=/export TAG=/g" /etc/profile.d/tag.sh && \
rm -rf /var/lib/apt/lists/* && \
apt-get remove -y dos2unix git build-essential && \
apt-get autoremove -y && \
apt-get clean && \
chmod +x /root/*.sh

# Expose ports and set working directory
EXPOSE 5080
WORKDIR /appsrc/lab/

# Start the webserver
CMD ["/bin/bash", "/root/start.sh"]

# Entrypoint
ENTRYPOINT ["/root/entrypoint.sh"]
132 changes: 0 additions & 132 deletions docker/lab/Dockerfile_production

This file was deleted.

Loading

0 comments on commit 7c8c1d2

Please sign in to comment.