-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da72c04
commit 325b18c
Showing
89 changed files
with
10,650 additions
and
0 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,7 @@ | ||
[flake8] | ||
max-line-length = 79 | ||
# E203: whitespace before :, flake8 disagrees with PEP-8 | ||
# W503: line break after binary operator, flake8 disagrees with PEP-8 | ||
ignore = E203, W503 | ||
exclude = | ||
docs/conf.py |
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 @@ | ||
rubintv2 |
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 @@ | ||
# This Dockerfile has four stages: | ||
# | ||
# base-image | ||
# Updates the base Python image with security patches and common system | ||
# packages. This image becomes the base of all other images. | ||
# dependencies-image | ||
# Installs third-party dependencies (requirements/main.txt) into a virtual | ||
# environment. This virtual environment is ideal for copying across build | ||
# stages. | ||
# install-image | ||
# Installs the app into the virtual environment. | ||
# runtime-image | ||
# - Copies the virtual environment into place. | ||
# - Runs a non-root user. | ||
# - Sets up the entrypoint and port. | ||
|
||
FROM python:3.11.1-slim-bullseye as base-image | ||
|
||
# Update system packages | ||
COPY scripts/install-base-packages.sh . | ||
RUN ./install-base-packages.sh && rm ./install-base-packages.sh | ||
|
||
FROM base-image AS dependencies-image | ||
|
||
# Install system packages only needed for building dependencies. | ||
COPY scripts/install-dependency-packages.sh . | ||
RUN ./install-dependency-packages.sh | ||
|
||
# Create a Python virtual environment | ||
ENV VIRTUAL_ENV=/opt/venv | ||
RUN python -m venv $VIRTUAL_ENV | ||
# Make sure we use the virtualenv | ||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
# Put the latest pip and setuptools in the virtualenv | ||
RUN pip install --upgrade --no-cache-dir pip setuptools wheel | ||
|
||
# Install the app's Python runtime dependencies | ||
COPY requirements/main.txt ./requirements.txt | ||
RUN pip install --quiet --no-cache-dir -r requirements.txt | ||
|
||
FROM dependencies-image AS install-image | ||
|
||
# Use the virtualenv | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
|
||
COPY . /workdir | ||
WORKDIR /workdir | ||
RUN pip install --no-cache-dir . | ||
|
||
FROM base-image AS runtime-image | ||
|
||
# Create a non-root user | ||
RUN useradd --create-home appuser | ||
|
||
# Copy the virtualenv | ||
COPY --from=install-image /opt/venv /opt/venv | ||
|
||
# Make sure we use the virtualenv | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
|
||
# Switch to the non-root user. | ||
USER appuser | ||
|
||
# Expose the port. | ||
EXPOSE 8080 | ||
|
||
# Run the application. | ||
CMD ["uvicorn", "rubintv.main:app", "--host", "0.0.0.0", "--port", "8080"] |
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,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2023 Association of Universities for Research in Astronomy, Inc. (AURA) | ||
|
||
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. |
Empty file.
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,27 @@ | ||
.PHONY: update-deps | ||
update-deps: | ||
pip install --upgrade pip-tools pip setuptools | ||
pip-compile --upgrade --resolver=backtracking --build-isolation --generate-hashes --output-file requirements/main.txt requirements/main.in | ||
pip-compile --upgrade --resolver=backtracking --build-isolation --generate-hashes --output-file requirements/dev.txt requirements/dev.in | ||
|
||
# Useful for testing against a Git version of Safir. | ||
.PHONY: update-deps-no-hashes | ||
update-deps-no-hashes: | ||
pip install --upgrade pip-tools pip setuptools | ||
pip-compile --upgrade --resolver=backtracking --build-isolation --allow-unsafe --output-file requirements/main.txt requirements/main.in | ||
pip-compile --upgrade --resolver=backtracking --build-isolation --allow-unsafe --output-file requirements/dev.txt requirements/dev.in | ||
|
||
.PHONY: init | ||
init: | ||
pip install --editable . | ||
pip install --upgrade -r requirements/main.txt -r requirements/dev.txt | ||
rm -rf .tox | ||
pip install --upgrade pre-commit tox | ||
pre-commit install | ||
|
||
.PHONY: update | ||
update: update-deps init | ||
|
||
.PHONY: run | ||
run: | ||
tox run -e run |
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,6 @@ | ||
# rubintv | ||
|
||
Web app to display Butler-served data sets | ||
Learn more at https://rubintv.lsst.io | ||
|
||
rubintv is developed with [FastAPI](https://fastapi.tiangolo.com) and [Safir](https://safir.lsst.io). |
Oops, something went wrong.