Skip to content
Open
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
File renamed without changes.
5 changes: 4 additions & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
cache: 'yarn'
- name: Install frontend dependencies
run: |
cd application/frontend
for i in 1 2 3; do
yarn install --frozen-lockfile --network-timeout 120000 && exit 0
echo "yarn install failed (attempt $i/3), retrying..."
Expand All @@ -24,7 +25,9 @@ jobs:
echo "yarn install failed after 3 attempts"
exit 1
- name: Check frontend formatting
run: yarn prettier --check "application/frontend/src/**/*.{ts,tsx,js}"
run: |
cd application/frontend
yarn prettier --check "src/**/*.{ts,tsx,js}"

build:
name: Lint Code Base
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ FROM node:lts as build
LABEL org.opencontainers.image.source = "https://github.com/OWASP/OpenCRE"
WORKDIR /code
COPY . /code
RUN yarn install && yarn build
RUN cd application/frontend && yarn install && yarn build

FROM python:3.11 as run

COPY --from=build /code /code
WORKDIR /code
COPY ./scripts/prod-docker-entrypoint.sh /code
RUN pip install -r requirements.txt gunicorn
RUN pip install -r application/requirements.txt gunicorn

ENV INSECURE_REQUESTS=1
ENV FLASK_CONFIG="production"
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ FROM node:lts AS build

WORKDIR /code
RUN apt-get update && apt-get install -y chromium
COPY package.json yarn.lock ./
RUN yarn install
COPY application/frontend/package.json application/frontend/yarn.lock application/frontend/
RUN cd application/frontend && yarn install

COPY . .

Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ dev-flask-docker:
. ./venv/bin/activate && INSECURE_REQUESTS=1 FLASK_APP=`pwd`/cre.py FLASK_CONFIG=development flask run --host=0.0.0.0 --port $(PORT)

e2e:
yarn build
(cd application/frontend && yarn build)
[ -d "./venv" ] && . ./venv/bin/activate &&\
export FLASK_APP="$(CURDIR)/cre.py" &&\
export FLASK_CONFIG=development &&\
export INSECURE_REQUESTS=1 &&\
flask run &
sleep 5
yarn test:e2e
(cd application/frontend && yarn test:e2e)
sleep 20
killall yarn
killall flask
Expand All @@ -69,7 +69,7 @@ cover:
install-deps-python:
[ -d "./venv" ] && . ./venv/bin/activate &&\
pip install --upgrade pip setuptools &&\
pip install -r requirements.txt
pip install -r application/requirements.txt

install-deps-typescript:
(cd application/frontend && yarn install)
Expand Down Expand Up @@ -100,13 +100,13 @@ docker-prod-run:
docker run -it -p $(PORT):$(PORT) opencre:$(shell git rev-parse HEAD)

lint:
[ -d "./venv" ] && . ./venv/bin/activate && black . && yarn lint
[ -d "./venv" ] && . ./venv/bin/activate && black . && (cd application/frontend && yarn lint)

mypy:
[ -d "./venv" ] && . ./venv/bin/activate && mypy --ignore-missing-imports --implicit-reexport --no-strict-optional --strict application

frontend:
yarn build
(cd application/frontend && yarn build)

clean:
find . -type f -name '*.pyc' -delete
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.