forked from repo-mirrors/sqlfluff
Compare commits
4 Commits
main
...
dev-enviro
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
093d5aa91e | ||
|
|
31faf7a1c9 | ||
|
|
3e15f0e2fe | ||
|
|
764aff6ac3 |
@@ -119,6 +119,18 @@ mode for you, as well as `requirements_dev.txt` and `plugins/sqlfluff-plugin-exa
|
||||
Additionally if a dbt virtual environment was specified, you will also have
|
||||
`dbt-core`, `dbt-postgres`, and `plugins/sqlfluff-templater-dbt` available.
|
||||
|
||||
#### Developing in Docker
|
||||
|
||||
To build a simple interactive Docker container, run the following commands:
|
||||
```shell
|
||||
make create
|
||||
make run
|
||||
```
|
||||
This container installs all Python dependencies, and mounts the project directory into
|
||||
the container. It doesn't install SQLFluff, but does set the path such that SQLFluff
|
||||
needn't be installed. The nuts and bolts are in place such that git should work seamlessly
|
||||
inside the container.
|
||||
|
||||
### Wiki
|
||||
|
||||
We have a [GitHub wiki](https://github.com/sqlfluff/sqlfluff/wiki) with some
|
||||
|
||||
13
Makefile
Normal file
13
Makefile
Normal file
@@ -0,0 +1,13 @@
|
||||
create:
|
||||
docker-compose build development
|
||||
|
||||
clean:
|
||||
docker system prune -f
|
||||
docker-compose stop
|
||||
docker rmi `docker images -a -q`
|
||||
|
||||
fresh:
|
||||
docker-compose build --no-cache development
|
||||
|
||||
run:
|
||||
docker-compose run --rm development
|
||||
@@ -1,21 +1,23 @@
|
||||
version: "2.4"
|
||||
|
||||
version: '3'
|
||||
services:
|
||||
app:
|
||||
platform: linux/amd64
|
||||
development:
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: plugins/sqlfluff-templater-dbt/docker/Dockerfile.dev
|
||||
context: .
|
||||
dockerfile: ./docker/development/Dockerfile
|
||||
environment:
|
||||
- SSH_AUTH_SOCK=/ssh-agent
|
||||
- POSTGRES_HOST=postgres
|
||||
volumes:
|
||||
# Host source code directory
|
||||
- ../../../:/app/
|
||||
- ../test/fixtures/dbt/profiles_yml:/root/.dbt
|
||||
- .:/app
|
||||
- ./test/fixtures/dbt/profiles_yml:/root/.dbt
|
||||
- ~/.gitconfig:/etc/gitconfig
|
||||
- ~/.ssh:/root/.ssh
|
||||
- /run/host-services/ssh-auth.sock:/ssh-agent
|
||||
stdin_open: true
|
||||
tty: true
|
||||
depends_on:
|
||||
- postgres
|
||||
entrypoint: /bin/bash
|
||||
environment:
|
||||
- POSTGRES_HOST=postgres
|
||||
tty: true
|
||||
postgres:
|
||||
image: postgres:14-bullseye
|
||||
environment:
|
||||
@@ -24,4 +26,4 @@ services:
|
||||
# NOTE: "5432:5432" makes the Postgres server accessible to both the host
|
||||
# developer machine *and* the "app" container in Docker. If you don't want
|
||||
# it available on the host machine, change this to simply "5432".
|
||||
- 5432:5432
|
||||
- "5432:5432"
|
||||
@@ -1,14 +1,20 @@
|
||||
FROM python:3.9-slim-bullseye
|
||||
FROM python:3.9
|
||||
|
||||
# Set separate working directory for easier debugging.
|
||||
WORKDIR /app
|
||||
ENV PYTHONPATH=/app;/app/src
|
||||
|
||||
# Install Git
|
||||
RUN apt-get -y update
|
||||
RUN apt-get -y install git
|
||||
|
||||
COPY requirements.txt /requirements.txt
|
||||
COPY requirements_dev.txt /requirements_dev.txt
|
||||
|
||||
#Install Dependencies
|
||||
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade pip setuptools wheel
|
||||
|
||||
# Install requirements separately
|
||||
# to take advantage of layer caching.
|
||||
COPY requirements*.txt .
|
||||
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade -r requirements.txt -r requirements_dev.txt
|
||||
RUN --mount=type=cache,target=/root/.cache/pip pip install -r /requirements.txt --upgrade --default-timeout=100
|
||||
RUN --mount=type=cache,target=/root/.cache/pip pip install -r /requirements_dev.txt --upgrade --default-timeout=100
|
||||
|
||||
# Set up dbt-related dependencies.
|
||||
RUN --mount=type=cache,target=/root/.cache/pip pip install dbt-postgres
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
pip install --no-dependencies -e . -e plugins/sqlfluff-templater-dbt
|
||||
pushd plugins/sqlfluff-templater-dbt/test/fixtures/dbt/dbt_project
|
||||
dbt deps
|
||||
popd
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
my_path="$( cd "$(dirname "$0")"; pwd -P)"
|
||||
docker compose -f ${my_path}/docker-compose.yml exec app bash
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
my_path="$( cd "$(dirname "$0")"; pwd -P)"
|
||||
docker compose -f ${my_path}/docker-compose.yml down -v --remove-orphans
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
export COMPOSE_DOCKER_CLI_BUILD=1
|
||||
export DOCKER_BUILDKIT=1
|
||||
my_path="$( cd "$(dirname "$0")"; pwd -P)"
|
||||
${my_path}/shutdown
|
||||
docker compose -f ${my_path}/docker-compose.yml build
|
||||
docker compose -f ${my_path}/docker-compose.yml up -d
|
||||
docker compose -f ${my_path}/docker-compose.yml exec app "/app/plugins/sqlfluff-templater-dbt/docker/init"
|
||||
@@ -17,6 +17,7 @@ pytest-cov
|
||||
pytest-xdist
|
||||
# MyPy
|
||||
mypy
|
||||
tox
|
||||
types-toml
|
||||
types-pkg_resources
|
||||
types-chardet
|
||||
|
||||
Reference in New Issue
Block a user