Skip to content

Commit

Permalink
add docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
NorskNoobing committed Nov 22, 2023
1 parent 034e4da commit 9c7a16d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
if [ -n "$GITHUB_TOKEN" ] || grep -q "TOKEN=" "$GITHUB_README_STREAK_STATS_PATH/.env"; then
echo "TOKEN=$GITHUB_TOKEN" > $GITHUB_README_STREAK_STATS_PATH/.env
else
echo "Error: GITHUB_TOKEN is not set or is empty. Please provide a value for the ENV variable GITHUB_TOKEN or create a valid .env file."
exit 1
fi

composer start
15 changes: 15 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ubuntu:latest
ENV GITHUB_TOKEN="" \
TZ="Etc/UTC" \
GITHUB_README_STREAK_STATS_PATH=/mnt/github-readme-streak-stats
ARG DEBIAN_FRONTEND=noninteractive
COPY . $GITHUB_README_STREAK_STATS_PATH
WORKDIR $GITHUB_README_STREAK_STATS_PATH
RUN apt-get update && \
apt-get install -y php php-curl php-xml composer inkscape
RUN composer install
EXPOSE 8000
RUN chmod +x $GITHUB_README_STREAK_STATS_PATH/docker/entrypoint.sh
#Uncomment CMD and comment out ENTRYPOINT for debugging of the image
#CMD ["tail", "-f", "/dev/null"]
ENTRYPOINT [ "./docker/entrypoint.sh" ]
23 changes: 23 additions & 0 deletions docs/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Build docker image
Build the image by running the following command in the reporoot.
```bash
docker build -t github-readme-streak-stats . --progress plain
```
# Create docker container
After building the image, you can run it by using either `docker run` or `docker compose`.
## Docker run
```bash
docker run --name github-streak -p 8000:8000 -e GITHUB_TOKEN=YOUR_GITHUB_TOKEN_HERE github-readme-streak-stats
```
## Docker compose
```yml
version: '3'
services:
github-streak:
container_name: github-streak
image: github-readme-streak-stats
ports:
- 8000:8000
environment:
- GITHUB_TOKEN=YOUR_GITHUB_TOKEN_HERE
```

0 comments on commit 9c7a16d

Please sign in to comment.