build(docker): setup Dockerfile, docker-compose and .env

This commit is contained in:
Anhgelus Morhtuuzh 2024-04-14 14:36:29 +02:00
parent a30bda9de3
commit 8ffd8a7f0f
No known key found for this signature in database
GPG key ID: CF4550297832A29F
5 changed files with 45 additions and 0 deletions

4
.dockerignore Normal file
View file

@ -0,0 +1,4 @@
README.md
.env
.env.example
.gitignore

11
.env.example Normal file
View file

@ -0,0 +1,11 @@
##############
# PostgreSQL #
##############
POSTGRES_PASSWORD=your_database_password
POSTGRES_USER=your_database_user
POSTGRES_DB=les-copaings
##############
# Bot #
##############
TOKEN=your_token

1
.gitignore vendored
View file

@ -22,3 +22,4 @@
go.work go.work
.idea .idea
.env

13
Dockerfile Normal file
View file

@ -0,0 +1,13 @@
FROM golang:1.22-alpine
WORKDIR /app
COPY . .
RUN apk add git
RUN go mod tidy && go build -o app .
ENV TOKEN=""
CMD ./app -token $TOKEN

16
docker-compose.yml Normal file
View file

@ -0,0 +1,16 @@
services:
bot:
build: .
env_file:
- .env
volumes:
- ./tmp:/app/config
depends_on:
- redis
- postgres
redis:
image: redis:alpine
postgres:
image: postgres:alpine
env_file:
- .env