Skip to content

Commit

Permalink
Merge pull request #64 from evo-company/small-repo-improvments
Browse files Browse the repository at this point in the history
refactor docker and lets files
  • Loading branch information
kindermax committed Jul 26, 2022
2 parents 57508c0 + 9635c89 commit c0f27c0
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 23 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ env
.idea
.cache
.pytest_cache
.vscode
.vscode
todo
TODO
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ COPY requirements-tests.txt .
RUN python3 -m pip install \
--no-deps --no-cache-dir --disable-pip-version-check \
-r requirements-tests.txt
RUN python3 -m pip install tox

FROM tests as examples

RUN python3 -m pip install \
flask==2.1.3 \
aiohttp==3.8.1
aiohttp==3.8.1
38 changes: 19 additions & 19 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
version: '3'
version: '3.7'

services:
docs:
image: hiku-docs
base: &base
image: hiku-base
working_dir: /work
user: ${CURRENT_UID}
volumes:
- ./:/work
init: true
environment:
PYTHONPATH: .
PYTHONBUFFERED: 1

docs:
<<: *base
image: hiku-docs
command: sphinx-build -b html docs build

examples-base: &examples-base
<<: *base
image: hiku-examples
working_dir: /work
init: true
environment:
PYTHONPATH: .
PYTHONBUFFERED: 1
volumes:
- ./:/work
ports:
- 5000:5000

Expand All @@ -32,18 +33,17 @@ services:

examples-aiohttp:
<<: *examples-base
command: python3 examples/graphql_aiohttp.py

test:
command: python3 examples/graphql_aiohttp.py

test-base: &test-base
<<: *base
image: hiku-tests
working_dir: /work
volumes:
- ./:/work
environment:
PYTHONPATH: .

test:
<<: *test-base
depends_on:
- pg
command: py.test

pg:
image: postgres:13-alpine
image: postgres:13-alpine
32 changes: 30 additions & 2 deletions lets.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
shell: bash

env:
CURRENT_UID:
sh: echo "`id -u`:`id -g`"

commands:
release:
description: |
Expand All @@ -20,17 +24,24 @@ commands:
git commit -m "Release ${LETSOPT_VERSION}"
git tag -a v${LETSOPT_VERSION} -m "${LETSOPT_MESSAGE}"
git push --tags
_build-base:
description: Build base docker image
cmd: docker build -t hiku-base -f Dockerfile --target base .

_build-examples:
description: Build docker image for examples
depends: [_build-base]
cmd: docker build -t hiku-examples -f Dockerfile --target examples .

_build-docs:
description: Build docker image for docs
depends: [_build-base]
cmd: docker build -t hiku-docs -f Dockerfile --target docs .

_build-tests:
description: Build docker image for test
depends: [_build-base]
cmd: docker build -t hiku-tests -f Dockerfile --target tests .

docs:
Expand All @@ -43,6 +54,23 @@ commands:
depends: [_build-tests]
cmd: docker-compose run --rm test

flake:
description: Run flake8
depends: [_build-tests]
cmd: docker-compose run --rm test-base tox -e flake8

reqs:
description: Update requirements.txt
cmd: pip-compile -U requirements.in

reqs-docs:
description: Update requirements-docs.txt
cmd: pip-compile -U requirements-docs.in

reqs-tests:
description: Update requirements-tests.txt
cmd: pip-compile -U requirements-tests.in

examples-federation:
description: Run federation app from examples
depends: [_build-examples]
Expand All @@ -56,4 +84,4 @@ commands:
examples-aiohttp:
description: Run aiohttp app from examples
depends: [_build-examples]
cmd: docker-compose up examples-aiohttp
cmd: docker-compose up examples-aiohttp

0 comments on commit c0f27c0

Please sign in to comment.