-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use redis store for tracking favicon downloads
- Loading branch information
Showing
16 changed files
with
444 additions
and
464 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ app/static/assets | |
|
||
notebooks/data/ | ||
|
||
cache/ | ||
app/.working/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ | |
"python.analysis.extraPaths": [ | ||
"./app", | ||
"./app/services", | ||
"./app", | ||
"./app" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,37 +4,16 @@ ARG PYTHON_VERSION=3.12-slim-bookworm | |
FROM python:${PYTHON_VERSION} as base | ||
LABEL maintainer="Mike Glenn <[email protected]>" | ||
|
||
ARG PUID=${PUID:-1000} | ||
ARG PGID=${PGID:-1000} | ||
|
||
ARG USER=anvil | ||
ARG TZ=America/New_York | ||
ENV USER=${USER} | ||
ENV TZ=${TZ} | ||
|
||
ARG PROJECT_NAME | ||
ENV PROJECT_NAME=${PROJECT_NAME} | ||
|
||
ARG PROJECT_PATH=/app | ||
ENV PROJECT_PATH=${PROJECT_PATH} | ||
|
||
ARG ONBOARD_PORT=9830 | ||
ENV ONBOARD_PORT=${ONBOARD_PORT} | ||
|
||
ENV PYTHON_DEPS_PATH=/dependencies | ||
ENV PYTHONPATH="${PYTHONPATH}:${PYTHON_DEPS_PATH}" | ||
ENV PYTHONUNBUFFERED=TRUE | ||
|
||
ENV LANGUAGE=en_US.UTF-8 | ||
ENV LANG=en_US.UTF-8 | ||
ENV LC_ALL=C.UTF-8 | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV DEBCONF_NONINTERACTIVE_SEEN=true | ||
|
||
ENV HOME=/home/${USER} | ||
ARG TERM_SHELL=zsh | ||
ENV TERM_SHELL=${TERM_SHELL} | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
bash \ | ||
ca-certificates \ | ||
|
@@ -52,6 +31,68 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ | |
apt-get autoclean -y && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen | ||
ENV LANG en_US.UTF-8 | ||
ENV LANGUAGE en_US:en | ||
ENV LC_ALL en_US.UTF-8 | ||
|
||
|
||
############################## | ||
# Begin build | ||
############################## | ||
FROM base as build | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
binutils \ | ||
build-essential \ | ||
pkg-config gfortran \ | ||
cmake \ | ||
coreutils \ | ||
extra-cmake-modules \ | ||
findutils \ | ||
git \ | ||
openssl \ | ||
openssh-client \ | ||
sqlite3 \ | ||
libsqlite3-dev && \ | ||
apt-get autoremove -fy && \ | ||
apt-get clean && \ | ||
apt-get autoclean -y && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY requirements.txt requirements.txt | ||
RUN pip3 install --upgrade pip && \ | ||
pip3 install --upgrade setuptools && \ | ||
pip3 install --upgrade wheel && \ | ||
mkdir -p ${PYTHON_DEPS_PATH} && \ | ||
pip3 install --no-cache-dir --target=${PYTHON_DEPS_PATH} -r requirements.txt && \ | ||
rm -rf requirements.txt | ||
|
||
|
||
############################## | ||
# Begin user_base | ||
############################## | ||
FROM base as user_base | ||
|
||
ARG PUID=${PUID:-1000} | ||
ARG PGID=${PGID:-1000} | ||
|
||
ARG USER=anvil | ||
ENV USER=${USER} | ||
|
||
ARG PROJECT_NAME | ||
ENV PROJECT_NAME=${PROJECT_NAME} | ||
|
||
ARG PROJECT_PATH=/app | ||
ENV PROJECT_PATH=${PROJECT_PATH} | ||
|
||
ARG ONBOARD_PORT=9830 | ||
ENV ONBOARD_PORT=${ONBOARD_PORT} | ||
|
||
ENV HOME=/home/${USER} | ||
ARG TERM_SHELL=zsh | ||
ENV TERM_SHELL=${TERM_SHELL} | ||
|
||
RUN sed -i 's/UID_MAX .*/UID_MAX 100000/' /etc/login.defs && \ | ||
groupadd --gid ${PGID} ${USER} && \ | ||
useradd --uid ${PUID} --gid ${PGID} -s /bin/${TERM_SHELL} -m ${USER} && \ | ||
|
@@ -78,13 +119,13 @@ if [ "$(id -u)" = "0" ]; then | |
groupmod -o -g ${PGID:-1000} ${USER} | ||
usermod -o -u ${PUID:-1000} ${USER} | ||
|
||
# get gid of docker socket file | ||
SOCK_DOCKER_GID=`stat -c %g /var/run/docker.sock` | ||
groupmod -o -g "$SOCK_DOCKER_GID" ${USER} | ||
chown ${USER}:${USER} /var/run/docker.sock | ||
|
||
# Add call to gosu to drop from root user to jenkins user | ||
# Add call to gosu to drop from root user | ||
# when running original entrypoint | ||
set -- gosu ${USER} "$@" | ||
else | ||
sudo chown -R ${USER}:${USER} /var/run/docker.sock | ||
fi | ||
|
||
echo "Running: $@" | ||
|
@@ -94,66 +135,29 @@ EOF | |
WORKDIR $PROJECT_PATH | ||
ENTRYPOINT [ "/usr/local/bin/docker-entrypoint.sh" ] | ||
|
||
|
||
############################## | ||
# Begin build | ||
############################## | ||
FROM base as build | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
binutils \ | ||
build-essential \ | ||
pkg-config gfortran \ | ||
cmake \ | ||
coreutils \ | ||
extra-cmake-modules \ | ||
findutils \ | ||
git \ | ||
openssl \ | ||
openssh-client \ | ||
sqlite3 \ | ||
libsqlite3-dev && \ | ||
apt-get autoremove -fy && \ | ||
apt-get clean && \ | ||
apt-get autoclean -y && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY requirements.txt requirements.txt | ||
RUN pip3 install --upgrade pip && \ | ||
pip3 install --upgrade setuptools && \ | ||
pip3 install --upgrade wheel && \ | ||
mkdir -p ${PYTHON_DEPS_PATH} && \ | ||
chown -R ${USER}:${USER} ${PROJECT_PATH} ${PYTHON_DEPS_PATH} && \ | ||
pip3 install --no-cache-dir --target=${PYTHON_DEPS_PATH} -r requirements.txt && \ | ||
rm -rf requirements.txt | ||
|
||
|
||
############################## | ||
# Begin production | ||
############################## | ||
FROM base as production | ||
FROM user_base as production | ||
|
||
COPY --from=build --chown=${USER}:${USER} ${PYTHON_DEPS_PATH} ${PYTHON_DEPS_PATH} | ||
COPY --from=build --chown=${USER}:${USER} ${PYTHON_DEPS_PATH} ${PYTHON_DEPS_PATH} | ||
COPY --chown=${USER}:${USER} app ${PROJECT_PATH} | ||
|
||
ENV FLASK_ENV=production | ||
|
||
RUN mkdir /cache && \ | ||
chown -R ${USER}:${USER} /cache && \ | ||
mkdir -p /app/static/icons && \ | ||
mkdir -p /app/static/assets &&\ | ||
RUN mkdir -p /app/static/icons && \ | ||
mkdir -p /app/static/assets && \ | ||
chown -R ${USER}:${USER} /app/static | ||
|
||
HEALTHCHECK --interval=10s --timeout=3s --start-period=40s \ | ||
CMD wget --no-verbose --tries=1 --spider --no-check-certificate http://localhost:$ONBOARD_PORT/api/healthcheck || exit 1 | ||
|
||
|
||
CMD [ "python3", "app.py" ] | ||
|
||
############################## | ||
# Begin jupyter-devcontainer | ||
# Begin jupyter-builder | ||
############################## | ||
FROM build as jupyter-devcontainer | ||
FROM build as jupyter-builder | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
graphviz \ | ||
|
@@ -173,11 +177,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ | |
apt-get autoclean -y && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
############################## | ||
# Begin jupyter-builder | ||
############################## | ||
FROM jupyter-devcontainer as jupyter-builder | ||
|
||
RUN pip3 install --no-cache-dir --target=${PYTHON_DEPS_PATH} docutils h5py ipykernel ipython jupyter jupyterhub notebook numpy nltk pyyaml pylint scikit-learn scipy==1.11.0 watermark | ||
RUN pip3 install --no-cache-dir --target=${PYTHON_DEPS_PATH} --no-deps --prefer-binary matplotlib seaborn plotly graphviz imutils keras | ||
RUN pip3 install --no-cache-dir --target=${PYTHON_DEPS_PATH} --prefer-binary pandas-datareader bottleneck scipy duckdb sqlalchemy pyautogui requests_cache statsmodels | ||
|
@@ -186,16 +185,15 @@ RUN pip3 install --no-cache-dir --target=${PYTHON_DEPS_PATH} --prefer-binary pan | |
############################## | ||
# Begin devcontainer | ||
############################## | ||
FROM jupyter-devcontainer as devcontainer | ||
|
||
COPY --from=jupyter-builder --chown=${USER}:${USER} ${PYTHON_DEPS_PATH} ${PYTHON_DEPS_PATH} | ||
FROM user_base as devcontainer | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
ansible \ | ||
bash-completion \ | ||
dnsutils \ | ||
exa \ | ||
iproute2 \ | ||
iputils-ping \ | ||
jq \ | ||
openssh-client \ | ||
ripgrep \ | ||
|
@@ -219,8 +217,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ | |
USER ${USER} | ||
|
||
COPY .devcontainer .devcontainer | ||
RUN LC_ALL=C.UTF-8 ansible-playbook --inventory 127.0.0.1 --connection=local .devcontainer/ansible/requirements.yml && \ | ||
LC_ALL=C.UTF-8 ansible-playbook --inventory 127.0.0.1 --connection=local .devcontainer/ansible/install-docker.yml | ||
|
||
RUN ansible-playbook --inventory 127.0.0.1 --connection=local .devcontainer/ansible/requirements.yml && \ | ||
ansible-playbook --inventory 127.0.0.1 --connection=local .devcontainer/ansible/install-docker.yml | ||
|
||
COPY --from=jupyter-builder --chown=${USER}:${USER} ${PYTHON_DEPS_PATH} ${PYTHON_DEPS_PATH} | ||
|
||
# https://code.visualstudio.com/remote/advancedcontainers/start-processes#_adding-startup-commands-to-the-docker-image-instead | ||
CMD [ "sleep", "infinity" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.