diff options
author | 2022-02-04 20:45:43 -0500 | |
---|---|---|
committer | 2022-02-04 20:45:43 -0500 | |
commit | 1226fe709748bb1ff4993d1689121001fda83102 (patch) | |
tree | 6d94ee0426a1eb1b54311ea7ca64c327f4a15398 | |
parent | Merge pull request #388 from python-discord/dependabot/npm_and_yarn/webpack-5... (diff) | |
parent | Bump Node in Dockerfile (diff) |
Merge pull request #258 from python-discord/docker-compose
Add Docker Setup
-rw-r--r-- | .dockerignore | 11 | ||||
-rw-r--r-- | Dockerfile | 16 | ||||
-rw-r--r-- | docker-compose.yaml | 52 |
3 files changed, 79 insertions, 0 deletions
diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b08266c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +# Ignore Everything +* + +# Include required files +!public/ +!src/ +!.swcrc +!package.json +!tsconfig.json +!webpack.config.js +!yarn.lock diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5468d09 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM node:16-slim +WORKDIR /app + +# Copy in lock files +COPY package.json . +COPY yarn.lock . + +# Install dependencies +RUN yarn install + +# Copy program in +COPY . . + +# Serve the frontend +ENTRYPOINT ["yarn", "run"] +CMD ["start", "--host", "0.0.0.0"] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..1e4c405 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,52 @@ +version: "3.6" + +services: + mongo: + image: mongo:latest + ports: + - "27017:27017" + environment: + MONGO_INITDB_ROOT_USERNAME: forms-backend + MONGO_INITDB_ROOT_PASSWORD: forms-backend + MONGO_INITDB_DATABASE: pydis_forms + + snekbox: + image: ghcr.io/python-discord/snekbox:latest + ipc: none + ports: + - "127.0.0.1:8060:8060" + privileged: true + + backend: + image: ghcr.io/python-discord/forms-backend + depends_on: + - mongo + - snekbox + ports: + - "8000:8000" + environment: + - DATABASE_URL=mongodb://forms-backend:forms-backend@mongo:27017 + - SNEKBOX_URL=http://snekbox:8060/eval + - OAUTH2_CLIENT_ID + - OAUTH2_CLIENT_SECRET + - ALLOWED_URL + - DEBUG=true + - PRODUCTION=false + env_file: + - .env + + frontend: + build: + context: . + dockerfile: Dockerfile + depends_on: + - backend + volumes: + - .:/app:ro + - /app/node_modules # Ensure dependencies do not collide with a user's local install + ports: + - "3000:3000" + environment: + - BACKEND_URL=http://localhost:8000/ + env_file: + - .env |