Skip to content

Commit

Permalink
initial docker-compose setup for local testing (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile-sentry authored Oct 19, 2023
1 parent 56856d0 commit 3031f08
Show file tree
Hide file tree
Showing 13 changed files with 858 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/mock-data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: mock-data
on:
push:
branches: [master, test-me-*]
pull_request:

jobs:
mock-data:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: docker compose up --wait
- run: while ! curl --fail --silent http://localhost:3000; do sleep .5; done
timeout-minutes: 1
37 changes: 37 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
x-base-env: &x-base-env
RELEASE: 2023+compose
RUBY_BACKEND: http://ruby:4567
DB_HOST: postgres
DB_USERNAME: postgres
DB_PASSWORD: postgres
DB_DATABASE: postgres

services:
react:
build: react
init: true
ports: [3000:3000]
flask:
build: flask
environment:
<<: *x-base-env
FLASK_ENV: test
FLASK_APP_DSN: http://flask@mini-relay:9989/3
init: true
ports: [8080:8080]
ruby:
build: ruby
environment:
<<: *x-base-env
init: true
mini-relay:
build: mini-relay
init: true
ports: [9989:9989]
postgres:
image: 'postgres:alpine'
environment:
- POSTGRES_PASSWORD=postgres
init: true
volumes:
- ./postgres/data/empowerplant.sql:/docker-entrypoint-initdb.d/empowerplant.sql:ro
1 change: 1 addition & 0 deletions flask/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/venv
9 changes: 9 additions & 0 deletions flask/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3.11-slim-bookworm

WORKDIR /src
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD ["flask", "run", "--host", "0.0.0.0", "--port", "8080"]
1 change: 1 addition & 0 deletions mini-relay/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/venv
9 changes: 9 additions & 0 deletions mini-relay/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3.11-slim-bookworm

WORKDIR /src
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD ["flask", "run", "--host", "0.0.0.0", "--port", "9989"]
11 changes: 11 additions & 0 deletions mini-relay/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import flask

app = flask.Flask(__name__)


@app.post('/api/<p>/envelope/')
def envelope(p: str) -> flask.Response:
# TODO: save out flask.request.data
ret = app.make_response(('', 204))
ret.access_control_allow_origin = '*'
return ret
7 changes: 7 additions & 0 deletions mini-relay/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
blinker==1.6.2
click==8.1.7
Flask==2.3.3
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.3
Werkzeug==2.3.7
Loading

0 comments on commit 3031f08

Please sign in to comment.