From 83e77722b8352dd37ec0b002a0b2f9e3e79087f6 Mon Sep 17 00:00:00 2001 From: parksb Date: Tue, 7 May 2024 15:36:30 +0900 Subject: [PATCH] chore: write docker compose file --- docker-compose.yml | 50 ++++++++++++++++++++++++++++++++++++++++++++++ server/Dockerfile | 6 +----- 2 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a727211 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,50 @@ +version: '3.9' +services: + darim-mariadb10: + image: mariadb:10 + container_name: darim-mariadb10 + ports: + - 3306:3306 + environment: + - MARIADB_ROOT_PASSWORD_HASH= + volumes: + - darim-mariadb10:/var/lib/mysql + command: + - --character-set-server=utf8mb4 + - --collation-server=utf8mb4_unicode_ci + networks: + - darim_net + darim-redis7: + image: redis:7 + container_name: darim-redis7 + ports: + - 6379:6379 + volumes: + - darim-redis7:/data + networks: + - darim_net + darim-server: + build: server + image: darim-server:latest + container_name: darim-server + ports: + - 9150:9150 + depends_on: + - darim-mariadb10 + - darim-redis7 + networks: + - darim_net + darim-api-gateway: + build: api-gateway + image: darim-api-gateway:latest + container_name: darim-api-gateway + ports: + - 80:80 + - 443:443 + depends_on: + - darim-server + networks: + - darim_net +networks: + darim_net: + driver: bridge diff --git a/server/Dockerfile b/server/Dockerfile index 3359831..2a0a03c 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -12,13 +12,9 @@ RUN cargo build --release FROM ubuntu:latest ENV DEBIAN_FRONTEND noninteractive - WORKDIR /root -COPY --from=builder /root/target/release/darim-server ./app RUN apt-get update && apt-get install -y mysql-server mysql-client -RUN echo 'deb http://security.ubuntu.com/ubuntu xenial-security main' | tee /etc/apt/sources.list.d/xenial-security.list -RUN apt-get update && apt-get install -y libmysqlclient20 -RUN ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.3.20 /usr/lib/libmysqlclient.so.20 +COPY --from=builder /root/target/release/darim-server ./app CMD ["./app"]