Skip to content

Commit

Permalink
sidzan&beevk_setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Lungsangg committed Jan 11, 2024
1 parent 1775e8a commit 859afd0
Show file tree
Hide file tree
Showing 14 changed files with 2,206 additions and 2,430 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,10 @@ static/sheetrank.json

env/*
dump/*
tmp/*
log/*
/static/bundles
/dockerData

.env
.envrc
37 changes: 20 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
# Use an official Python runtime as a parent image
FROM python:3.7-slim
# Use node-python image as the base image
FROM beevk/node-python:0.2

# Set the working directory to /app
# Set the working directory inside the container
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app
# Copy the local_settings.py file to the working directory
COPY ./sefaria/local_settings.py ./sefaria/local_settings.py

# Install psycopg2 dependencies
RUN apt-get update && apt-get install -y libpq-dev
# Copy the requirements.txt file and install dependencies
COPY requirements.txt ./
COPY package*.json ./

# Install gcc
RUN apt-get update && apt-get install -y gcc
RUN pip install -r requirements.txt
RUN npm install --unsafe-perm

# Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt
COPY ./node ./node
COPY ./static/js ./static/js

# Make port 8000 available to the world outside this container
EXPOSE 8000
RUN npm run setup
RUN npm run build-prod

# Define environment variable
ENV NAME Sefaria-Project
COPY . ./

# Run app.py when the container launches
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
# Run Django migrations and start the server
CMD ["bash", "-c", "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"]

# Expose the port that the Django server will listen on
EXPOSE 8000
8 changes: 8 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# exit on error
set -o errexit

pip install -r requirements.txt
python manage.py collectstatic --no-input
python manage.py migrate
python manage.py createsu
55 changes: 11 additions & 44 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,16 @@
version: '3'
version: '3.8'

services:
web:
build: .
sefaria:
image: ghcr.io/sidzan/sidzan/sefaria:latest
container_name: sefaria-local
ports:
- "8000:8000"
volumes:
- .:/app
depends_on:
- db
- cache
- postgres

db:
image: "mongo:4.4"
ports:
- "27018:27017"
volumes:
- mongo-data:/data/db

cache:
image: "redis:latest"
ports:
- "6379:6379"

node:
image: "node:latest"
working_dir: /app
volumes:
- .:/app
command: npm start
ports:
- "3000:3000"

postgres:
image: "postgres:latest"
environment:
POSTGRES_USER: admin
POSTGRES_PASSWORD: admin
POSTGRES_DB: sefaria
ports:
- "5433:5432"
volumes:
- postgres-data:/var/lib/postgresql/sefaria_data

volumes:
mongo-data:
postgres-data:
- MONGO_DATABASE_NAME=${MONGO_DATABASE_NAME}
- MONGO_HOST=${MONGO_HOST}
- POSTGRESQL_DATABASE_NAME=${POSTGRESQL_DATABASE_NAME}
- POSTGRESQL_HOST=${POSTGRESQL_HOST}
- POSTGRESQL_PASSWORD=${POSTGRESQL_PASSWORD}
- POSTGRESQL_USER=${POSTGRESQL_USER}
- REDIS_HOST=${REDIS_HOST}
Loading

0 comments on commit 859afd0

Please sign in to comment.