-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
143 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
COMPOSE_PROJECT_NAME=whisper-bot | ||
|
||
POSTGRES_MIGRATION_DSN="postgres://postgres:postgres@postgres:5432/whisperbot?sslmode=disable" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM golang:1.22 as builder | ||
|
||
WORKDIR /app | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
COPY . ./ | ||
|
||
RUN go build ./cmd/main.go | ||
|
||
FROM alpine:latest | ||
RUN apk add --no-cache ca-certificates libc6-compat | ||
|
||
WORKDIR /app | ||
COPY --from=builder /app . | ||
|
||
CMD ["./main"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM golang:1.22 | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
RUN go mod download && go mod verify | ||
|
||
RUN go build ./cmd/main.go | ||
|
||
CMD ["./main"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
APP_TOKEN= | ||
APP_WEBHOOK_URL= | ||
APP_WEBHOOK_PATH="/bot/" | ||
APP_BASE_URL=":9000" | ||
APP_OPENAI_TOKEN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
version: '3' | ||
|
||
services: | ||
postgres: | ||
image: postgres:14.1 | ||
container_name: db | ||
ports: | ||
- "5432:5432" | ||
restart: always | ||
environment: | ||
POSTGRES_PASSWORD: postgres | ||
volumes: | ||
- ./db/:/var/lib/postgresql/data/:rw | ||
- ./postgres/init:/docker-entrypoint-initdb.d | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U postgres"] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
app: | ||
container_name: app | ||
build: | ||
context: ../ | ||
dockerfile: ./.docker/app/Dockerfile.dev | ||
ports: | ||
- "8080:8080" | ||
restart: always | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
env_file: | ||
- bot_dev.env | ||
|
||
migrations: | ||
container_name: migrations | ||
build: | ||
context: ../ | ||
dockerfile: ./.docker/migrations/Dockerfile.dev | ||
command: migrate apply --url ${POSTGRES_MIGRATION_DSN} --dir "file://migrations" | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
env_file: | ||
- bot_dev.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
version: '3' | ||
|
||
services: | ||
postgres: | ||
image: postgres:14.1 | ||
container_name: db | ||
environment: | ||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} | ||
POSTGRES_DB: ${POSTGRES_DB} | ||
POSTGRES_USER: ${POSTGRES_USER} | ||
PGDATA: /var/lib/postgresql/data/ | ||
volumes: | ||
- ./db:/var/lib/postgresql/data/:rw | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
env_file: | ||
- .env.prod | ||
|
||
app: | ||
container_name: app | ||
image: bifidokk/whisper-bot-app:latest | ||
ports: | ||
- ${API_PORT}:8080 | ||
restart: always | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
env_file: | ||
- .env.prod | ||
|
||
migrations: | ||
container_name: migrations | ||
image: bifidokk/whisper-bot-migrations:latest | ||
command: migrate apply --url ${POSTGRES_MIGRATION_DSN} --dir "file://migrations" | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
env_file: | ||
- .env.prod | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM arigaio/atlas:latest | ||
|
||
COPY migrations /migrations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM arigaio/atlas:latest | ||
|
||
COPY migrations /migrations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -e | ||
export PGPASSWORD=postgres; | ||
psql -v ON_ERROR_STOP=1 --username "postgres" <<-EOSQL | ||
CREATE DATABASE whisperbot; | ||
GRANT ALL PRIVILEGES ON DATABASE whisperbot TO "postgres"; | ||
EOSQL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/.idea | ||
/.vscode | ||
__debug_* | ||
__debug_* | ||
bot_dev.env | ||
/.docker/db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
up: | ||
@docker-compose --file .docker/docker-compose.dev.yml up --build -d --remove-orphans | ||
|
||
down: | ||
@docker-compose --file .docker/docker-compose.dev.yml down |
Empty file.