Last active
July 7, 2022 11:18
-
-
Save kingbuzzman/f74f8f0bc0bec07650770c55ec24e1a1 to your computer and use it in GitHub Desktop.
factoryboy docker local development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.8" | |
volumes: | |
pip_cache: | |
services: | |
mongo: | |
image: mongo | |
command: mongod --quiet --logpath /dev/null | |
postgres: | |
image: postgres:alpine | |
environment: | |
- POSTGRES_PASSWORD=password | |
py37: &pyenv | |
build: | |
context: . | |
dockerfile: Dockerfile.template | |
args: | |
PYTHON_VERSION: python:3.7 | |
volumes: | |
- .:/factory_boy | |
tmpfs: | |
- /factory_boy/.tox,mode=777 | |
depends_on: | |
- mongo | |
- postgres | |
environment: | |
- PYENV_NAME=py37 | |
command: bash -c 'POSTGRES_DATABASE=factory_boy_test_$$PYENV_NAME tox -f $$PYENV_NAME-cov' | |
py38: | |
<<: *pyenv | |
build: | |
context: . | |
dockerfile: Dockerfile.template | |
args: | |
PYTHON_VERSION: python:3.8 | |
environment: | |
- PYENV_NAME=py38 | |
py39: | |
<<: *pyenv | |
build: | |
context: . | |
dockerfile: Dockerfile.template | |
args: | |
PYTHON_VERSION: python:3.9 | |
environment: | |
- PYENV_NAME=py39 | |
py310: | |
<<: *pyenv | |
build: | |
context: . | |
dockerfile: Dockerfile.template | |
args: | |
PYTHON_VERSION: python:3.10 | |
environment: | |
- PYENV_NAME=py310 | |
pypy37: | |
<<: *pyenv | |
build: | |
context: . | |
dockerfile: Dockerfile.template | |
args: | |
PYTHON_VERSION: pypy:3.7 | |
environment: | |
- PYENV_NAME=pypy37 | |
pypy38: | |
<<: *pyenv | |
build: | |
context: . | |
dockerfile: Dockerfile.template | |
args: | |
PYTHON_VERSION: pypy:3.8 | |
environment: | |
- PYENV_NAME=pypy38 | |
pypy39: | |
<<: *pyenv | |
build: | |
context: . | |
dockerfile: Dockerfile.template | |
args: | |
PYTHON_VERSION: pypy:3.9 | |
environment: | |
- PYENV_NAME=pypy39 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# syntax=docker/dockerfile:experimental | |
ARG PYTHON_VERSION | |
FROM ${PYTHON_VERSION} | |
ENV TOX_WORK_DIR=/tmp/.tox | |
ENV MONGO_HOST=mongo | |
ENV POSTGRES_HOST=postgres | |
RUN apt update && \ | |
DEBIAN_FRONTEND=noninteractive apt install -y build-essential | |
RUN --mount=type=cache,target=/root/.cache/pip pip install -U pip tox-factor flake8 isort check-manifest | |
WORKDIR /factory_boy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use this copy all the code below [yes the parenthesis also], and run it under your
factoryboy
directory:And do NOT commit
docker-compose.yml
orDockerfile.template
!