From 40d8e9df6489559df5fdf5175bd03a5c3e5ad13b Mon Sep 17 00:00:00 2001 From: aldwin7894 <14094252+aldwin7894@users.noreply.github.com> Date: Thu, 18 Aug 2022 11:53:13 +0800 Subject: [PATCH] Docker optimizations --- config/redis.conf | 8 ++++++++ docker-compose.yml | 17 ++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 config/redis.conf diff --git a/config/redis.conf b/config/redis.conf new file mode 100644 index 00000000..da742c62 --- /dev/null +++ b/config/redis.conf @@ -0,0 +1,8 @@ +maxmemory 100mb +maxmemory-policy allkeys-lfu +maxmemory-samples 5 +lfu-log-factor 10 +lfu-decay-time 1 +save 300 5 +loglevel verbose +appendonly yes diff --git a/docker-compose.yml b/docker-compose.yml index ad50776c..a751b129 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,8 @@ version: "3.9" services: db: - image: postgres:latest + container_name: aldwin7894-pg + image: postgres:14-alpine restart: always environment: - TZ @@ -11,17 +12,19 @@ services: ports: - 5432:5432 volumes: - - "dbdata:/var/lib/postgresql/data" + - dbdata:/var/lib/postgresql/data redis: - image: redis:latest - command: redis-server + container_name: aldwin7894-redis + image: redis:alpine + command: redis-server /usr/local/etc/redis/redis.conf restart: always environment: - TZ ports: - - "6379:6379" + - 6379:6379 volumes: - - 'redis:/data' + - redis:/data + - ./config/redis.conf:/usr/local/etc/redis/redis.conf web: build: context: . @@ -29,7 +32,7 @@ services: args: - "OCCSON_ACCESS_TOKEN_ARG=${OCCSON_ACCESS_TOKEN}" - "OCCSON_PASSPHRASE_ARG=${OCCSON_PASSPHRASE}" - container_name: aldwin7894 + container_name: aldwin7894-app image: aldwin7894/aldwin7894:prod restart: always depends_on: