aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-04-14 14:36:29 +0200
committerAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-04-14 14:36:29 +0200
commit8ffd8a7f0f48bfb5b70667a5f4c1af523f18d495 (patch)
treec550fcd7551320186411beed3cc1ec7d991299b8
parenta30bda9de37b6b52083ed6a8401ab368009c7a5c (diff)
build(docker): setup Dockerfile, docker-compose and .env
-rw-r--r--.dockerignore4
-rw-r--r--.env.example11
-rw-r--r--.gitignore1
-rw-r--r--Dockerfile13
-rw-r--r--docker-compose.yml16
5 files changed, 45 insertions, 0 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..6ada887
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,4 @@
+README.md
+.env
+.env.example
+.gitignore \ No newline at end of file
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..cd13f27
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,11 @@
+##############
+# PostgreSQL #
+##############
+POSTGRES_PASSWORD=your_database_password
+POSTGRES_USER=your_database_user
+POSTGRES_DB=les-copaings
+
+##############
+# Bot #
+##############
+TOKEN=your_token
diff --git a/.gitignore b/.gitignore
index 728c95a..2632f72 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,4 @@
go.work
.idea
+.env
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..b56e430
--- /dev/null
+++ b/Dockerfile
@@ -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
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..280805a
--- /dev/null
+++ b/docker-compose.yml
@@ -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 \ No newline at end of file