Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task WI-46: Setup CMS using django-csp - merge main 2023 11 13 #745

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
937 changes: 640 additions & 297 deletions CHANGELOG.md

Large diffs are not rendered by default.

68 changes: 23 additions & 45 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,72 +1,50 @@
FROM python:3.8-buster as python-base

LABEL maintainer="TACC-ACI-WMA <[email protected]>"

ARG DEBIAN_FRONTEND=noninteractive

ENV PYTHONUNBUFFERED 1

# https://python-poetry.org/docs/configuration/#using-environment-variables
ENV POETRY_VERSION=1.4.0 \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1 \
PYSETUP_PATH="/opt/pysetup" \
VENV_PATH="/opt/pysetup/.venv"

# prepend poetry and venv to path
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"

FROM python-base as builder-base

RUN apt-get update && apt-get install -y \
build-essential python3-dev \
libldap2-dev libsasl2-dev ldap-utils tox \
lcov valgrind vim \
&& pip3 install uwsgi

RUN pip3 install --upgrade pip setuptools wheel
ENV PYTHONUNBUFFERED 1
ENV PATH="/root/.local/bin:$PATH"

# https://python-poetry.org/docs/configuration/#using-environment-variables
ENV POETRY_VERSION=1.4.0 \
POETRY_VIRTUALENVS_CREATE=false \
POETRY_NO_INTERACTION=1

RUN pip3 install --upgrade pip setuptools wheel
# Install Poetry - respects $POETRY_VERSION & $POETRY_HOME
RUN curl -sSL https://install.python-poetry.org | python3 -

RUN mkdir /code
# copy project requirement files here to ensure they will be cached.
WORKDIR $PYSETUP_PATH
COPY pyproject.toml poetry.lock ./

COPY pyproject.toml poetry.lock /code/
WORKDIR /code
# install runtime deps - uses $POETRY_VIRTUALENVS_IN_PROJECT internally
RUN poetry install --no-dev

# `development` image is used for local development
FROM python-base as development
WORKDIR $PYSETUP_PATH

# copy in our built poetry + venv
COPY --from=builder-base $POETRY_HOME $POETRY_HOME
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH

# quicker install as runtime deps are already installed
COPY . /code/
RUN poetry install

# `production` image is used for deployed runtime environments
FROM python-base as production

# install node
RUN curl -sL https://deb.nodesource.com/setup_17.x | bash -
RUN apt-get install -y nodejs
FROM node:18 as node_build
COPY package.json package-lock.json /code/
WORKDIR /code
RUN npm ci

COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH
COPY . /code/
ARG PROJECT_NAME
ARG BUILD_ID
RUN npm run build --project=$PROJECT_NAME --build-id=$BUILD_ID

# `production` image is used for deployed runtime environments
FROM python-base as production
# Make CMS logs
RUN mkdir -p /var/log/cms

# load files
RUN mkdir /code
COPY . /code
WORKDIR /code

# build assets
RUN npm ci
ARG PROJECT_NAME
ARG BUILD_ID
RUN npm run build --project=$PROJECT_NAME --build-id=$BUILD_ID
COPY --from=node_build /code/ /code
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DOCKERHUB_REPO := taccwma/$(shell cat ./docker_repo.var)
PROJECT_NAME := $(shell cat ./docker_repo.var)
PROJECT_NAME := $(shell cat ./project_name.var)
DOCKER_TAG ?= $(shell git rev-parse --short HEAD)
BUILD_ID := $(shell git describe --always)
DOCKER_IMAGE := $(DOCKERHUB_REPO):$(DOCKER_TAG)
Expand Down
Loading