From 3bc6913bc2b15e92957c05589219006121df36d2 Mon Sep 17 00:00:00 2001 From: Ronald Langeveld Date: Mon, 7 Oct 2024 14:31:22 +0100 Subject: [PATCH] Added init Docker files ref ENG-1594 - initial docker files, copy and pasted from our spike we did in Spain early this year. https://www.notion.so/ghost/Double-down-on-Docker-30cc59d498da44058fb64e0ce8bebff4 --- .dockerignore | 1 + Dockerfile | 19 +++++++++++++++++++ docker-compose.yml | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..b512c09d47 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..7b112ea7e0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM node:18.18.2 + +WORKDIR /app + +COPY package.json ./ +COPY yarn.lock ./ + +COPY . . + +# Install node-gyp globally +RUN npm install -g node-gyp + +RUN yarn install + +RUN npm rebuild + +EXPOSE 2368 + +CMD ["yarn", "dev"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..e4487db1d6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,38 @@ +version: '3.8' + +services: + nodejs: + build: + context: . + dockerfile: Dockerfile + container_name: ghost-node + restart: unless-stopped + ports: + - "2368:2368" + volumes: + - .:/app + networks: + - app-network + + mysql: + image: mysql:8.0.35 + hostname: ghost-mysql-2 + container_name: ghost-mysql-2 + # We'll need to look into how we can further fine tune the memory usage/performance here + command: --innodb-buffer-pool-size=1G --innodb-log-buffer-size=500M --innodb-change-buffer-max-size=50 --innodb-flush-log-at-trx_commit=0 --innodb-flush-method=O_DIRECT + ports: + - "3306:3306" + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: ghost + restart: always + healthcheck: + test: "mysql -uroot -proot ghost -e 'select 1'" + interval: 1s + retries: 120 + networks: + - app-network + +networks: + app-network: + driver: bridge \ No newline at end of file