Skip to content
Merged
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
70 changes: 49 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,64 @@
version: 2.1
executors:
docker-publisher:
machine: true
jobs:
setup-lint-test:
docker:
- image: circleci/python:latest
build:
executor: docker-publisher
steps:
- checkout
- restore_cache:
keys:
- deps-{{ checksum "pyproject.toml" }}
- run:
command: ./ci/setup.sh
name: Setup
- save_cache:
key: deps-{{ checksum "pyproject.toml" }}
command: ./build-dist-wheel.sh
name: Build Python Wheel
- store_test_results:
path: test-results/pytest
- store_artifacts:
path: test-results/coverage
- run:
command: ./build-runnable-image.sh
name: Build Runnable Docker Image
- run:
command: ./ci/archive-image.sh ./<< pipeline.parameters.image_archive >>
name: Archive Docker image
- persist_to_workspace:
paths:
- /home/circleci/project/.poetry/virtualenvs
- ./<< pipeline.parameters.image_archive >>
- ./dist
- ./docker-env
- ./ci/tag-and-push.sh
root: .
deploy:
executor: docker-publisher
steps:
- attach_workspace:
at: .
- run:
command: ./lint.sh
name: Lint
command: docker load -i "./<< pipeline.parameters.image_archive >>"
name: Load archive Docker image
- run:
command: ./test.sh
name: Test
- store_test_results:
path: test-results
command: ./ci/tag-and-push.sh
name: Publish Docker Image to Docker Hub
parameters:
image_archive:
default: image.tar
type: string
version: 2.1
workflows:
version: 2.1
main:
jobs:
setup-lint-test:
- filters:
- build:
filters:
branches:
only:
- release
- develop
- circleci
- deploy:
filters:
branches:
only:
- release
- circleci
requires:
- build
version: 2.1

5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"trailingComma": "es5",
"arrowParens": "always",
"tabWidth": 2
}
14 changes: 4 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:alpine AS codex-install
ARG BASE_VERSION
FROM ajslater/python-alpine:$BASE_VERSION AS codex-install

RUN echo "**** install system wheel building packages ****" && \
apk add --no-cache \
Expand All @@ -17,14 +18,8 @@ RUN pip3 install wheel
COPY dist/*.whl /tmp/
RUN pip3 wheel /tmp/*.whl --wheel-dir=/wheels

FROM python:alpine

RUN echo "*** UID/GID Init. TODO move to a base image ***"
RUN apk add --no-cache shadow
RUN echo "*** create default user ***" && \
adduser --uid 911 --home /config --shell /bin/false --disabled-password abc && \
usermod -G users abc
COPY docker/usr/local/sbin/*.sh /usr/local/sbin/
FROM ajslater/python-alpine:$BASE_VERSION
LABEL version python${BASE_VERSION}_codex-${PKG_VERSION}

RUN echo "*** install system runtime packages ***" && \
apk add --no-cache \
Expand All @@ -44,5 +39,4 @@ RUN pip3 install --no-index --find-links=/wheels /wheels/codex*.whl
VOLUME /comics
VOLUME /config
EXPOSE 9810
ENTRYPOINT ["/usr/local/sbin/entrypoint.sh"]
CMD ["/usr/local/bin/codex"]
56 changes: 22 additions & 34 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -1,47 +1,35 @@
FROM ubuntu:focal
FROM ajslater/codex-builder:focal_1.0.0-db5d3fe

ARG DEBIAN_FRONTEND=noninteractive

RUN echo "*** install system build dependencies ***"
WORKDIR /app
RUN apt-get update && apt-get install -y \
gnupg2 \
ca-certificates
COPY docker/nodesource/nodesource.focal.list /etc/apt/sources.list.d/
COPY docker/nodesource/nodesource.gpg.key .
RUN apt-key add ./nodesource.gpg.key
RUN apt-get update && apt-get install -y \
build-essential \
nodejs \
libffi-dev \
libjpeg-dev \
libssl-dev \
libwebp-dev \
libyaml-dev \
python3-pip \
python3-venv \
zlib1g-dev

RUN echo "*** install poetry ***" && \
pip3 install -U poetry
#############
# APP SETUP #
#############

RUN echo "**** copying source for dev build ****"
COPY . .

RUN echo "*** install API build dependencies ***" && \
poetry install --no-root --no-dev
RUN ./setup-dev.sh

WORKDIR /app/frontend
RUN echo "*** install frontend build dependencies ***" && \
npm install
########
# TEST #
########

WORKDIR /app
RUN echo "*** run lint ***"
RUN ./lint.sh

RUN echo "*** copy choices from frontend ***" && \
cp src/choices/* ../codex/choices/
RUN echo "*** run tests ***"
RUN ./test.sh

# WORKDIR /app
# RUN echo "*** run tests ***"
# RUN ./test.sh
# WORKDIR /app/frontend
VOLUME /test-results
RUN cp -a test-results/* /test-results

#########
# BUILD #
#########

WORKDIR /app/frontend

RUN echo "*** build frontend ***" && \
rm -rf ../codex/static_build && \
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Codex is a comic archive browser and reader.
## State of Development

Codex is in alpha test. It has not received widespread testing.
[Please file bug reports on GitHub.](https://github.com/ajslater/codex/issues)
[Please file bug reports on GitHub.](https://github.com/ajslater/codex/issues) It is still possible that the data model might change enough that subsequent versions might require a database reset.

## Demonstration

Expand Down Expand Up @@ -173,6 +173,7 @@ Specify a reverse proxy sub path (if you have one) in the config/hypercorn.toml

```toml
root_path = "/codex"

```

#### Nginx Reverse Proxy 502 when container is refreshed.
Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions build-docker-image.sh

This file was deleted.

4 changes: 4 additions & 0 deletions build-runnable-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
# Build a codex docker image suitable for running from Dockerfile
. ./docker-env
docker build -t "$IMAGE" --build-arg "BASE_VERSION=$BASE_VERSION" --build-arg "PKG_VERSION=$PKG_VERSION" .
4 changes: 4 additions & 0 deletions ci/archive-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -euo pipefail
source ./docker-env
docker save -o "$1" "$IMAGE"
30 changes: 0 additions & 30 deletions ci/setup.sh

This file was deleted.

9 changes: 9 additions & 0 deletions ci/tag-and-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -euo pipefail
source ./docker-env
VERSION=python${BASE_VERSION}_mylar-${PKG_VERSION}
TAG=$VERSION-$(echo "$CIRCLE_SHA1" | head -c 7)
docker tag "$IMAGE" "$IMAGE:$TAG"
docker tag "$IMAGE" "$IMAGE:latest"
docker login -u="$DOCKER_USER" -p="$DOCKER_PASS"
docker push "$REPO"
2 changes: 0 additions & 2 deletions copy-dist.sh

This file was deleted.

1 change: 1 addition & 0 deletions docker-compose-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ services:
container_name: codex-builder
volumes:
- ./dist/:/dist/
- ./test-results/:/app/test-results/
4 changes: 4 additions & 0 deletions docker-env
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
REPO=ajslater/codex
IMAGE=ajslater/codex
BASE_VERSION=latest
PKG_VERSION=v0.5.0
PUID=501
PGID=20
8 changes: 0 additions & 8 deletions docker/usr/local/sbin/entrypoint.sh

This file was deleted.

15 changes: 0 additions & 15 deletions docker/usr/local/sbin/moduser.sh

This file was deleted.

12 changes: 3 additions & 9 deletions frontend/src/browser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
>
<template #selection="{ item }">
{{ item.text }}
<span v-if="isOtherFiltersSelected" id="filterSuffix">
+
</span>
<span v-if="isOtherFiltersSelected" id="filterSuffix"> + </span>
</template>
<template #item="data">
<v-slide-x-transition hide-on-leave>
Expand Down Expand Up @@ -100,9 +98,7 @@
<template #activator="{ on }">
<v-list-item v-on="on">
<v-list-item-content>
<v-list-item-title>
Settings
</v-list-item-title>
<v-list-item-title> Settings </v-list-item-title>
</v-list-item-content>
</v-list-item>
</template>
Expand Down Expand Up @@ -146,9 +142,7 @@
Go to <a :href="adminURL">the admin panel</a> and add a comic library.
</h2>
<div v-else>
<h2>
An administrator must log in and add some libraries.
</h2>
<h2>An administrator must log in and add some libraries.</h2>
<h3>You may log in or register with the top right menu.</h3>
</div>
</div>
Expand Down
14 changes: 4 additions & 10 deletions frontend/src/components/auth-dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
<template #activator="{ on }">
<v-list-item v-on="on" @click="loginDialogOpened">
<v-list-item-content>
<v-list-item-title>
Login
</v-list-item-title>
<v-list-item-title> Login </v-list-item-title>
</v-list-item-content>
</v-list-item>
</template>
Expand Down Expand Up @@ -54,12 +52,8 @@
type="password"
/>
</v-expand-transition>
<v-btn v-if="!registerMode" ripple @click="login">
Login
</v-btn>
<v-btn v-else ripple @click="register">
Register
</v-btn>
<v-btn v-if="!registerMode" ripple @click="login"> Login </v-btn>
<v-btn v-else ripple @click="register"> Register </v-btn>
<v-switch
v-if="enableRegistration"
v-model="registerMode"
Expand All @@ -69,7 +63,7 @@
Register
</v-switch>
<footer>
<small v-if="authFormError" style="color: red;">
<small v-if="authFormError" style="color: red">
{{ authFormError }}
</small>
<small v-else-if="enableRegistration"
Expand Down
2 changes: 1 addition & 1 deletion lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ poetry run isort --check-only --color .
poetry run black --check .
prettier --check .
# hadolint Dockerfile*
shellcheck ./*.sh
shellcheck -x ./*.sh
1 change: 1 addition & 0 deletions setup-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
echo "*** install API build dependencies ***"
pip3 install -U poetry
poetry install --no-root
npm install -g prettier prettier-plugin-toml

echo "*** install frontend build dependencies ***"
bash -c "cd frontend && npm install"
Expand Down