Skip to content

Commit a273caf

Browse files
committed
Update dependencies and add for dev
- Adject for poetry in production - Using snok/install-poetry for actions - Python version down to 3.8 - Fixed lost using poetry run
1 parent 9450908 commit a273caf

11 files changed

+824
-270
lines changed

.github/workflows/build_image.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
with:
2222
context: .
2323
file: Dockerfile-base
24-
tags: coscupweb-base:22.03.13
24+
tags: coscupweb-base:22.05.04
2525
load: true
2626
- name: List images
2727
run: docker images

.github/workflows/docker-compose.yml

-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ name: DockerCompose
22

33
on:
44
push:
5-
paths:
6-
- 'Dockerfile-**'
7-
- 'docker-compose.yml'
8-
- '.github/workflows/docker-compose.yml'
9-
branches:
10-
- 'code-style'
115
workflow_dispatch:
126

137
jobs:

.github/workflows/pytest.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,16 @@ jobs:
1919
uses: actions/setup-python@v3
2020
with:
2121
python-version: ${{ matrix.python-version }}
22-
- name: Install PIP
23-
run: pip install -r requirements.txt
24-
- name: Install pytest and pytest-cov
25-
run: pip install pytest pytest-cov
22+
- name: Install and configure Poetry
23+
uses: snok/install-poetry@v1
24+
with:
25+
version: 1.1.13
26+
virtualenvs-create: true
27+
virtualenvs-in-project: false
28+
installer-parallel: true
29+
- name: Install dependencies
30+
run: poetry install
2631
- name: Create setting.py
2732
run: mv setting_sample.py setting.py
2833
- name: Run Testing
29-
run: PYTHONPATH=./ pytest -vv --cov-report=term-missing --cov ./
34+
run: PYTHONPATH=./ poetry run pytest -vv --cov-report=term-missing --cov ./

Dockerfile-app

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM coscupweb-base:22.03.13
1+
FROM coscupweb-base:22.05.04
22

33
ADD ./client_secret.json ./client_secret.json
44
ADD ./privacy.md ./privacy.md

Dockerfile-app-dev

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM coscupweb-base:22.03.13
1+
FROM coscupweb-base:22.05.04
22

33
#ADD ./client_secret.json ./client_secret.json
44
ADD ./privacy.md ./privacy.md

Dockerfile-base

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
FROM alpine:3.15.0
1+
FROM alpine:3.15.2
22

33
WORKDIR /app
4-
ADD ./requirements.txt ./requirements.txt
4+
ADD pyproject.toml poetry.lock ./
5+
ENV PATH="/root/.poetry/bin:${PATH}"
56
RUN \
67
apk update && apk upgrade && \
78
apk add --no-cache python3 ca-certificates libmemcached-dev && \
@@ -10,14 +11,10 @@ RUN \
1011
wget https://github.com/jemalloc/jemalloc/releases/download/5.2.1/jemalloc-5.2.1.tar.bz2 && \
1112
tar xvjf jemalloc-5.2.1.tar.bz2 && cd jemalloc-5.2.1 && ./configure && make && make install && \
1213
cd ../ && rm -rf ./jemalloc* && \
13-
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
14-
python3 get-pip.py && \
15-
rm get-pip.py && \
16-
pip install poetry
14+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 - && \
15+
find $HOME/.poetry/lib/poetry/_vendor/ -mindepth 1 -maxdepth 1 -not -name py3.9 -type d | xargs rm -rf && \
16+
poetry install
1717

18-
# Install PIP dependencies
19-
ADD pyproject.toml poetry.lock /app/
20-
RUN poetry install
2118

2219
# Cleanup
2320
RUN apk del .build-deps && \

build-base.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
docker build --no-cache=true -t coscupweb-base:22.03.13 -f ./Dockerfile-base ./
1+
docker build --no-cache=true -t coscupweb-base:22.05.04 -f ./Dockerfile-base ./

docker-compose.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ services:
1919
- backend
2020

2121
webappbase:
22-
image: "coscupweb-base:22.03.13"
22+
image: "coscupweb-base:22.05.04"
2323
build:
2424
context: .
2525
dockerfile: ./Dockerfile-base
@@ -45,7 +45,7 @@ services:
4545
replicas: 4
4646
networks:
4747
- backend
48-
command: ["uwsgi", "./uwsgi.ini"]
48+
command: ["poetry", "run", "uwsgi", "./uwsgi.ini"]
4949

5050
celery_worker:
5151
image: "volunteer-app:prod"
@@ -66,7 +66,7 @@ services:
6666
- C_FORCE_ROOT=true
6767
networks:
6868
- backend
69-
command: ["celery", "-A", "celery_task.celery_main", "worker", "-B", "-l", "info", "-O", "fair", "-c", "4", "--logfile", "./log/log.log"]
69+
command: ["poetry", "run", "celery", "-A", "celery_task.celery_main", "worker", "-B", "-l", "info", "-O", "fair", "-c", "4", "--logfile", "./log/log.log"]
7070

7171
memcached-prod:
7272
image: "memcached:1.6.6-alpine"

0 commit comments

Comments
 (0)