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

Use DB for usage examples. #33

Closed
wants to merge 8 commits into from
Closed
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
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.swp
*.swo
db.sql
words
migrate/migrate
words_image.tar
loader_image.tar
data/*.bz2
commands.md
cover.out
testdata/*
backups/*
.vscode
.git
.cache
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ secret.go
*.swo
db.sql
words
migrate/migrate
words_image.tar
loader_image.tar
data/*.csv
data/*.bz2
commands.md
cover.out
testdata/e2e_corrected.json
backups/*

.vscode/
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ FROM golang:alpine AS builder
RUN apk update && apk add --no-cache git gcc g++ ca-certificates apache2-utils
WORKDIR /go/src/words
COPY *.go ./
Run go get -d -v -tags netgo -installsuffix netgo
RUN go get -d -v -tags netgo -installsuffix netgo
# netgo and ldflags makes sure that dns resolver and binary are statically
# linked giving the ability for smaller images.
RUN go build -tags netgo -installsuffix netgo -ldflags '-extldflags "-static"' -o /go/bin/words
Expand All @@ -28,6 +28,5 @@ FROM scratch
# solution?
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/bin/words /go/bin/words
COPY data/*.csv data/
# TODO: This should be moved to the CMD starting it up.
ENTRYPOINT ["/go/bin/words", "--db_path=/words-vol/db/db.sql"]
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,23 @@ repository. It should live in data/links.csv and data/sentences.csv

It can be downloaded from here:
https://tatoeba.org/eng/downloads

## QuickStart:
1. Create a telegram bot using @BotFather if you don't have one yet
2. Create secret.go in the root folder with the following content
```go

package main

const BotToken = "TOKEN PROVIDED BY BOT FATHER"
```
3. Download links and senteces from https://tatoeba.org/eng/downloads
4. Put fetched csv data under `./data`
5. Run using one of the following:
- using Go: `go build && ./words`
- using Docker:
```bash
sudo docker volume create words-vol
sudo docker build -t words .
sudo docker run --rm --name words-app --mount source=words-vol,target=/words-vol/db/ words
```
Loading