Skip to content

Commit

Permalink
Fix docker
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida committed Sep 24, 2024
1 parent 811de6d commit 0530956
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# the backend uses psycopg2 under the hood, so any valid connection string for it will
# work; just replace the scheme with `shillelagh+multicorn2`
engine = create_engine(
"shillelagh+multicorn2://shillelagh:shillelagh123@localhost:12345/shillelagh",
"shillelagh+multicorn2://shillelagh:shillelagh123@localhost:5432/shillelagh",
)
connection = engine.connect()

Expand Down
10 changes: 9 additions & 1 deletion postgres/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ USER root
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
git \
postgresql-server-dev-13 \
python3 \
python3-dev \
python3-pip \
python3-venv \
wget

# Download, build, and install multicorn2
Expand All @@ -24,7 +26,13 @@ RUN wget https://github.com/pgsql-io/multicorn2/archive/refs/tags/v2.5.tar.gz &&
make install


RUN pip install -e '.[all]'
# Create a virtual environment and install dependencies
RUN python3 -m venv /code/venv && \
/code/venv/bin/pip install --upgrade pip && \
/code/venv/bin/pip install -e '.[all]'

# Set environment variable for PostgreSQL to use the virtual environment
ENV PATH="/code/venv/bin:$PATH"

# Switch back to the default postgres user
USER postgres
5 changes: 3 additions & 2 deletions postgres/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ version: '3.8'

services:
postgres:
build: .
build:
context: ..
dockerfile: postgres/Dockerfile
environment:
POSTGRES_PASSWORD: shillelagh123
POSTGRES_USER: shillelagh
POSTGRES_DB: shillelagh
volumes:
- db_data:/var/lib/postgresql/data
- ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
- ..:/src
ports:
- "5432:5432"

Expand Down

0 comments on commit 0530956

Please sign in to comment.