-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Added Docker Support #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .git | ||
| .gitignore | ||
| node_modules/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| ## Dockerfile | ||
|
|
||
| FROM node:alpine | ||
| RUN mkdir -p /opt/app | ||
| WORKDIR /opt/app | ||
| RUN adduser -S app | ||
officialasit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| COPY . . | ||
| RUN yarn install | ||
| RUN chown -R app /opt/app | ||
officialasit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| USER app | ||
| EXPOSE 3000 5555 | ||
| CMD ["yarn", "dev"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Calendso (Docker-Compose) | ||
|
|
||
| > Note: Make sure you have docker & docker-compose installed on the server / system | ||
|
|
||
| ## Generating Docker Image | ||
|
|
||
| As the Docker Image is not available on Docker Hub yet, you can easily compile using the Dockerfile | ||
|
|
||
| ```bash | ||
| # cd to root directory of Project | ||
| cd .. | ||
| docker build -t calendso . | ||
| ``` | ||
|
|
||
| - Once Docker Image is generated, you can setup your Google API Key. | ||
| - Put your Google OAuth2 Credentials JSON into `SECRET_KEY_HERE` of `docker-compose.yml` file | ||
|
|
||
| ## Start Container / Usage | ||
|
|
||
| ```bash | ||
| docker-compose up -d | ||
| ``` | ||
|
|
||
|
|
||
| ## Use the following to add new users. | ||
| ```sh | ||
| docker ps | ||
|
|
||
| ## Copy docker container ID of calends:latest | ||
| docker exec -it [CONTAINER_ID] /bin/sh | ||
| ./startUp.sh | ||
officialasit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
| > Prisma Studio Started on Port 5555 | CTRL + c to stop & `exit` | ||
|
|
||
| ## Stop Containers | ||
| ```bash | ||
| docker-compose down | ||
| ``` | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| version: "3.7" | ||
| services: | ||
| postgres: | ||
| image: postgres | ||
| environment: | ||
| POSTGRES_USER: postgres | ||
| POSTGRES_PASSWORD: p0stgr3s_pass | ||
| ports: | ||
| - '5432:5432' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it necessary to expose this port? The Calendso container will already find the database because of Docker's internal routing.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's a best practice to document them, for what it's worth. It also helps if you want to use an external postgresql client. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd recommend leaving it there but commented out as it could be a security issue for anyone who adds the compose file to their server and exposes their db port by accident. Docker exposed ports often bypass firewalls too! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rberrelleza, why is it a best practice? In the container on the Docker hub it's probably already mentioned if you want to use it that way. What it does now is use that port (possibly blocking other postgres services) and leave a security risk as @Soneji mentioned. |
||
| volumes: | ||
| - calendso-db:/var/lib/postgresql/data | ||
|
|
||
| calendso: | ||
| image: calendso | ||
officialasit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| environment: | ||
officialasit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| DATABASE_URL: 'postgresql://postgres:[email protected]:5432' | ||
officialasit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| GOOGLE_API_CREDENTIALS: 'SECRET_KEY_HERE' | ||
| depends_on: | ||
| - postgres | ||
| ports: | ||
| - '3000:3000' | ||
| - '5555:5555' | ||
|
|
||
|
|
||
| volumes: | ||
| calendso-db: | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| npx prisma db push --preview-feature | ||
| npx prisma studio |
Uh oh!
There was an error while loading. Please reload this page.