-
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.
Merge pull request #48 from princeton-ddss/44-create-dockerfile-to-co…
…ntainerize 44 create dockerfile
- Loading branch information
Showing
6 changed files
with
156 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2024 Colin Swaney and The Trustees of Princeton University | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
ARG PYTHON_BUILDER_IMAGE=3.11-slim-bookworm | ||
|
||
FROM python:${PYTHON_BUILDER_IMAGE} AS python-base | ||
ENV PIP_DEFAULT_TIMEOUT=100 \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=1 \ | ||
PIP_NO_CACHE_DIR=1 \ | ||
PIP_ROOT_USER_ACTION=ignore \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONFAULTHANDLER=1 \ | ||
PYTHONHASHSEED=random \ | ||
LANG=C.UTF-8 \ | ||
LC_ALL=C.UTF-8 | ||
RUN apt-get update \ | ||
&& apt-get upgrade -y \ | ||
&& apt-get install -y --no-install-recommends git tini \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /root/.cache \ | ||
&& rm -rf /var/apt/lists/* \ | ||
&& rm -rf /var/cache/apt/* \ | ||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false\ | ||
&& mkdir -p /workspace/app \ | ||
&& pip install --quiet -U pip wheel setuptools virtualenv | ||
|
||
FROM python-base AS build-base | ||
ENV PATH="/workspace/app/.venv/bin:/usr/local/bin:$PATH" | ||
RUN apt-get install -y --no-install-recommends build-essential curl \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /root/.cache \ | ||
&& rm -rf /var/apt/lists/* \ | ||
&& rm -rf /var/cache/apt/* \ | ||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false | ||
|
||
WORKDIR /workspace/app | ||
COPY pyproject.toml README.md .pre-commit-config.yaml LICENSE ./ | ||
# COPY scripts ./scripts/ | ||
# COPY public ./public/ | ||
# COPY resources ./resources/ | ||
RUN python -m venv /workspace/app/.venv | ||
|
||
FROM build-base AS prod-image | ||
ARG ENV_SECRETS="runtime-secrets" | ||
ENV PATH="/workspace/app/.venv/bin:$PATH" \ | ||
VIRTUAL_ENV="/workspace/app/.venv" \ | ||
ENV_SECRETS="${ENV_SECRETS}" \ | ||
PIP_DEFAULT_TIMEOUT=100 \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=1 \ | ||
PIP_NO_CACHE_DIR=1 \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONFAULTHANDLER=1 \ | ||
PYTHONHASHSEED=random | ||
WORKDIR /workspace/app | ||
COPY docs/ docs/ | ||
COPY tests/ tests/ | ||
COPY src/ src/ | ||
RUN pip install -e . | ||
STOPSIGNAL SIGINT | ||
EXPOSE 8000 | ||
ENV BLACKFISH_HOST="0.0.0.0" | ||
ENV BLACKFISH_PORT="8000" | ||
ENV BLACKFISH_HOME_DIR="/data" | ||
ENTRYPOINT ["tini","--" ] | ||
CMD [ "blackfish", "start", "--reload"] | ||
|
||
VOLUME /workspace/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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
ARG PYTHON_BUILDER_IMAGE=3.11-slim-bookworm | ||
|
||
FROM python:${PYTHON_BUILDER_IMAGE} AS python-base | ||
ENV PIP_DEFAULT_TIMEOUT=100 \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=1 \ | ||
PIP_NO_CACHE_DIR=1 \ | ||
PIP_ROOT_USER_ACTION=ignore \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONFAULTHANDLER=1 \ | ||
PYTHONHASHSEED=random \ | ||
LANG=C.UTF-8 \ | ||
LC_ALL=C.UTF-8 | ||
RUN apt-get update \ | ||
&& apt-get upgrade -y \ | ||
&& apt-get install -y --no-install-recommends git tini \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /root/.cache \ | ||
&& rm -rf /var/apt/lists/* \ | ||
&& rm -rf /var/cache/apt/* \ | ||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false\ | ||
&& mkdir -p /workspace/app \ | ||
&& pip install --quiet -U pip wheel setuptools virtualenv | ||
|
||
FROM python-base AS build-base | ||
ENV PATH="/workspace/app/.venv/bin:/usr/local/bin:$PATH" | ||
RUN apt-get install -y --no-install-recommends build-essential curl \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /root/.cache \ | ||
&& rm -rf /var/apt/lists/* \ | ||
&& rm -rf /var/cache/apt/* \ | ||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false | ||
|
||
WORKDIR /workspace/app | ||
COPY pyproject.toml README.md .pre-commit-config.yaml LICENSE ./ | ||
# COPY scripts ./scripts/ | ||
# COPY public ./public/ | ||
# COPY resources ./resources/ | ||
RUN python -m venv /workspace/app/.venv | ||
|
||
FROM build-base AS prod-image | ||
ARG ENV_SECRETS="runtime-secrets" | ||
ENV PATH="/workspace/app/.venv/bin:$PATH" \ | ||
VIRTUAL_ENV="/workspace/app/.venv" \ | ||
ENV_SECRETS="${ENV_SECRETS}" \ | ||
PIP_DEFAULT_TIMEOUT=100 \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=1 \ | ||
PIP_NO_CACHE_DIR=1 \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONFAULTHANDLER=1 \ | ||
PYTHONHASHSEED=random | ||
WORKDIR /workspace/app | ||
COPY docs/ docs/ | ||
COPY tests/ tests/ | ||
COPY src/ src/ | ||
RUN pip install -e . | ||
STOPSIGNAL SIGINT | ||
EXPOSE 8000 | ||
ENV BLACKFISH_HOST="0.0.0.0" | ||
ENV BLACKFISH_PORT="8000" | ||
ENV BLACKFISH_HOME_DIR="/data" | ||
ENTRYPOINT ["tini","--" ] | ||
CMD [ "blackfish", "start"] |
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