Skip to content

Commit

Permalink
Merge pull request #26 from datasektionen/docker
Browse files Browse the repository at this point in the history
Add Docker and docker-compose
  • Loading branch information
Herkarl committed Jan 30, 2024
2 parents ab9e1d0 + ca8528d commit 468f372
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 4 deletions.
1 change: 0 additions & 1 deletion .buildpacks

This file was deleted.

2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONTENT_URL=https://github.com/datasektionen/bawang-content.git
TOKEN=
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM golang:1.21-alpine

WORKDIR /app/

RUN apk add --no-cache git
COPY go.mod go.sum /app/
RUN go mod download && go mod verify

COPY taitan.go /app/
COPY pages /app/pages
COPY fuzz /app/fuzz
COPY anchor /app/anchor

RUN go build taitan.go

CMD ["./taitan", "-v"]
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ GET /:path
}
```

## Running
## Running

### Environment variables

| Name | Description |
|-------------|-----------------------------------------------------------------------------------------|
| PORT | The port to listen to requests on |
| TOKEN | GitHub Personal Access Token used for authorization when pulling the content repository |
| TOKEN | GitHub Personal Access Token used for authorization when pulling the content repository. (Only needed if the content repo is private) |
| CONTENT_URL | The repository to get content from |
| CONTENT_DIR | Directory to serve contents from. Setting this disables the automatic fetching using git and makes the `TOKEN` and `CONTENT_URL` unused. |

Expand All @@ -50,6 +50,12 @@ GET /:path
| -vv | Print more info messages |
| -w | Reload the contents when they change on disk |

### Docker

If you have docker installed, you can also run the repo using `docker-compose up --build`

Make sure to copy `.env.example` to `.env` first, and populate `TOKEN` with you personal github token if needed.

## API documentation

http://godoc.org/github.com/datasektionen/taitan
Expand All @@ -58,3 +64,4 @@ http://godoc.org/github.com/datasektionen/taitan/parse
## Public domain

I hereby release this code into the [public domain](https://creativecommons.org/publicdomain/zero/1.0/).

9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
taitan:
build: .
ports:
- 5000:5000
environment:
- PORT=5000
env_file:
- .env

0 comments on commit 468f372

Please sign in to comment.