Skip to content

Commit

Permalink
docs: add Docker files (#253)
Browse files Browse the repository at this point in the history
* add docker files to repo

* original suggestions

* use latest deno version

---------

Co-authored-by: Asher Gomez <[email protected]>
  • Loading branch information
lambtron and iuioiua authored Jun 19, 2023
1 parent 0a80be0 commit c470c4d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 44 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
README.md
.example.env
.vscode/
.github/
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM denoland/deno
EXPOSE 8000
WORKDIR /app
ADD . /app

# Add dependencies to the container's Deno cache
RUN deno cache main.ts
CMD ["task", "start"]
47 changes: 3 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,50 +208,9 @@ AWS Lightsail and Digital Ocean.
2. Create an account on [Docker Hub](https://hub.docker.com), a registry for
Docker container images.

3. Create a `Dockerfile` in the root of your repo:

```docker
FROM denoland/deno:1.32.4
EXPOSE 8000
WORKDIR /app
ADD . /app
# Add dependencies to the container's Deno cache
RUN deno cache main.ts --import-map=import_map.json
CMD ["run", "--allow-run", "--allow-write", "--allow-read", "--allow-env", "--allow-net", "main.ts"]
```

4. Create a `.dockerignore` file in the root folder of your repo to make sure
certain files are not deployed to the docker container:

```dockerignore
README.md
.example.env
.vscode/
.github/
```

5. A `docker-compose.yml` file will be needed to run the docker file on a VPS.
Here’s what that file in your repo's root folder will look like:

```yml
version: '3'

services:
web:
build: .
container_name: deno-sasskit
image: deno-image
environment:
- DENO_DEPLOYMENT_ID=${DENO_DEPLOYMENT_ID}
- GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}
- GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET}
- STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY}
- STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET}
- STRIPE_PREMIUM_PLAN_PRICE_ID=${STRIPE_PREMIUM_PLAN_PRICE_ID}
ports:
- "8000:8000"
```
> Note: the [`Dockerfile`](./Dockerfile), [`.dockerignore`](./.dockerignore) and
> [`docker-compose.yml`](./docker-compose.yml) files come included with this
> repo.
The values of the environmental variables are pulled from the `.env` file.

Expand Down
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3'

services:
web:
build: .
container_name: deno-saaskit
image: deno-image
environment:
- DENO_DEPLOYMENT_ID=${DENO_DEPLOYMENT_ID}
- GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}
- GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET}
- STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY}
- STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET}
- STRIPE_PREMIUM_PLAN_PRICE_ID=${STRIPE_PREMIUM_PLAN_PRICE_ID}
ports:
- "8000:8000"

0 comments on commit c470c4d

Please sign in to comment.