Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Added ghost service to base docker compose setup #21938

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RUN apt-get update && \
# Base DevContainer: for use in a Dev Container where your local code is mounted into the container
### Adding code and installing dependencies gets overridden by your local code/dependencies, so this is done in onCreateCommand
FROM base AS base-devcontainer
ARG WORKDIR
# Install Stripe CLI, zsh, playwright
RUN curl -s https://packages.stripe.dev/api/security/keypair/stripe-cli-gpg/public | gpg --dearmor | tee /usr/share/keyrings/stripe.gpg && \
echo "deb [signed-by=/usr/share/keyrings/stripe.gpg] https://packages.stripe.dev/stripe-cli-debian-local stable main" | tee -a /etc/apt/sources.list.d/stripe.list && \
Expand All @@ -28,7 +29,7 @@ RUN curl -s https://packages.stripe.dev/api/security/keypair/stripe-cli-gpg/publ
npx -y playwright@1.46.1 install --with-deps

ENV NX_DAEMON=true
ENV YARN_CACHE_FOLDER=/workspaces/ghost/.yarncache
ENV YARN_CACHE_FOLDER=$WORKDIR/.yarncache

EXPOSE 2368
EXPOSE 4200
Expand All @@ -47,21 +48,13 @@ 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
ARG WORKDIR
WORKDIR $WORKDIR
COPY ../../ .
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

ARG WORKDIR
WORKDIR $WORKDIR

COPY ../../ .

RUN yarn install --frozen-lockfile --prefer-offline --cache-folder $YARN_CACHE_FOLDER && \
cp -r .yarncache .yarncachecopy && \
rm -Rf .yarncachecopy/.tmp && \
yarn cache clean

ENTRYPOINT ["./.devcontainer/.docker/development.entrypoint.sh"]
ENTRYPOINT ["/home/ghost/.docker/development.entrypoint.sh"]
CMD ["yarn", "dev"]
6 changes: 6 additions & 0 deletions .docker/development.entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

yarn install --frozen-lockfile --prefer-offline

# Execute the CMD
exec "$@"
19 changes: 19 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
name: ghost

services:
ghost:
build:
context: .
dockerfile: ./.docker/Dockerfile
target: development
args:
WORKDIR: /home/ghost
ports:
- "2368:2368"
- "4200:4200"
profiles: [full]
volumes:
- .:/home/ghost
tty: true
env_file:
- .env
depends_on:
- mysql
- redis
mysql:
image: mysql:8.0.35
container_name: ghost-mysql
Expand Down
4 changes: 2 additions & 2 deletions ghost/core/test/e2e-browser/fixtures/ghost-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Stripe = require('stripe').Stripe;
const configUtils = require('../../utils/configUtils');

const startWebhookServer = (port) => {
const command = `stripe listen --forward-connect-to http://127.0.0.1:${port}/members/webhooks/stripe/ ${process.env.CI ? `--api-key ${process.env.STRIPE_SECRET_KEY}` : ''}`.trim();
const command = `stripe listen --forward-connect-to http://127.0.0.1:${port}/members/webhooks/stripe/ ${process.env.STRIPE_SECRET_KEY ? `--api-key ${process.env.STRIPE_SECRET_KEY}` : ''}`.trim();
const webhookServer = spawn(command.split(' ')[0], command.split(' ').slice(1));

// Adding event listeners here seems to prevent heisenbug where webhooks aren't received
Expand All @@ -22,7 +22,7 @@ const startWebhookServer = (port) => {
};

const getWebhookSecret = async () => {
const command = `stripe listen --print-secret ${process.env.CI ? `--api-key ${process.env.STRIPE_SECRET_KEY}` : ''}`.trim();
const command = `stripe listen --print-secret ${process.env.STRIPE_SECRET_KEY ? `--api-key ${process.env.STRIPE_SECRET_KEY}` : ''}`.trim();
const webhookSecret = (await promisify(exec)(command)).stdout;
return webhookSecret.toString().trim();
};
Expand Down
Loading