Skip to content
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

Add installing scripts #10

Merged
merged 3 commits into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM hayd/alpine-deno:1.6.2
EXPOSE 8000
WORKDIR /app
USER deno
COPY deps.ts .
RUN deno cache deps.ts
ADD . .
RUN deno cache server.ts # --unstable?
CMD ["./run.sh"]
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Pikne Zadania


## Installation

[Install Docker](https://docs.docker.com/engine/install/) if it's not installed. If you are on Unix-based distro, you can try:

```sh
# use the docker/docker-install script when you are lazy
curl -fsSL https://get.docker.com | sh
```

and don't forget to start `docker` service (with `service` or `systemctl`):

```sh
# start the docker service if it's not started
sudo service docker start
# enable it if you want to run docker at the boot
sudo service docker enable
```

Run our container (use `sudo` if you are not in `docker` group):

```sh
PORT=80
docker run --name pikne-zadania -dp $PORT:8000 nircek/pikne-zadania
# or if you want to run it at the boot
docker run --name pikne-zadania -dp $PORT:8000 --restart unless-stopped nircek/pikne-zadania
```

Perform updates automatically with the [Watchtower](https://github.com/containrrr/watchtower):

```sh
docker run --name watchtower -dv /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower
```
16 changes: 16 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
trap interrupt TERM INT
interrupt () {
echo "Interrupting with SIGINT and waiting 5s... "
kill $pid
timeout 5 sh -c "while kill -0 $pid &>/dev/null; do :; done"
exit
}

(
deno run --allow-net --allow-read=/app server.ts &
trap "kill -SIGINT $!; wait $!" TERM
wait $!
) &
pid=$!
wait