diff --git a/.devcontainer/compose.yml b/.devcontainer/compose.yml index a345459fc8..9cdc05ca96 100644 --- a/.devcontainer/compose.yml +++ b/.devcontainer/compose.yml @@ -11,6 +11,8 @@ services: context: ../ dockerfile: .docker/Dockerfile target: base-devcontainer + args: + WORKDIR: /workspaces/ghost pull_policy: never environment: - DEVCONTAINER=true @@ -21,30 +23,15 @@ services: redis: condition: service_healthy mysql: - image: mysql:8.0.35 - # 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" - environment: - MYSQL_ROOT_PASSWORD: root - MYSQL_DATABASE: ghost - restart: always - volumes: - - mysql-data:/var/lib/mysql - healthcheck: - test: "mysql -uroot -proot ghost -e 'select 1'" - interval: 1s - retries: 120 + extends: + file: ../compose.yml + service: mysql + container_name: ghost-devcontainer-mysql redis: - image: redis:7.0 - ports: - - "6379" - restart: always - healthcheck: - test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ] - interval: 1s - retries: 120 + extends: + file: ../compose.yml + service: redis + container_name: ghost-devcontainer-redis volumes: - mysql-data: \ No newline at end of file + mysql-data: diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 42428812fe..79a0d98e7c 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,4 +1,6 @@ ARG NODE_VERSION=20.15.1 +ARG WORKDIR=/home/ghost + ## Base Image used for all targets FROM node:$NODE_VERSION-bullseye-slim AS base RUN apt-get update && \ @@ -45,14 +47,14 @@ EXPOSE 7174 ### This is a full devcontainer with all the code and dependencies installed ### Useful in an environment like Github Codespaces where you don't mount your local code into the container FROM base-devcontainer AS full-devcontainer -WORKDIR /workspaces/ghost +WORKDIR $WORKDIR COPY ../../ . RUN yarn install --frozen-lockfile --prefer-offline --cache-folder $YARN_CACHE_FOLDER # Development Stage: alternative entrypoint for development with some caching optimizations FROM base-devcontainer AS development -WORKDIR /workspaces/ghost +WORKDIR $WORKDIR COPY ../../ . diff --git a/compose.yml b/compose.yml index f3292578ac..ce71107a53 100644 --- a/compose.yml +++ b/compose.yml @@ -26,6 +26,10 @@ services: ports: - "6379:6379" restart: always + healthcheck: + test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ] + interval: 1s + retries: 120 prometheus: profiles: [monitoring] image: prom/prometheus:v2.30.3