mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
af0f26c75f
no issue - Dev Containers let you work on Ghost in a consistent, isolated environment with all the necessary development dependencies pre-installed. VSCode (or Cursor) can effectively run _inside_ the container, providing a local quality development environment while working in a well-defined, isolated environment. - For now the default setup only works with "Clone repository in Container Volume" or "Clone PR in Container Volume" — this allows for a super quick and simple setup. We can also introduce another configuration to allow opening an existing local checkout in a Dev Container, but that's not quite ready yet. - This PR also added the `yarn clean:hard` command which: deletes all node_modules, cleans the yarn cache, and cleans the NX cache. This will be necessary for opening a local checkout in a Dev Container. - To learn more about Dev Containers, read this guide from VSCode: https://code.visualstudio.com/docs/devcontainers/containers#_personalizing-with-dotfile-repositories --------- Co-authored-by: Joe Grigg <joe@ghost.org> Co-authored-by: Steve Larson <9larsons@gmail.com>
64 lines
2.1 KiB
Docker
64 lines
2.1 KiB
Docker
ARG NODE_VERSION=20.15.1
|
|
## Base Image used for all targets
|
|
FROM node:$NODE_VERSION-bullseye-slim AS base
|
|
RUN apt-get update && \
|
|
apt-get install -y \
|
|
build-essential \
|
|
curl \
|
|
jq \
|
|
libjemalloc2 \
|
|
python3 \
|
|
tar
|
|
|
|
# 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
|
|
# 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 && \
|
|
apt update && \
|
|
apt install -y \
|
|
git \
|
|
stripe \
|
|
zsh \
|
|
default-mysql-client && \
|
|
npx -y playwright@1.46.1 install --with-deps
|
|
|
|
ENV NX_DAEMON=true
|
|
ENV YARN_CACHE_FOLDER=/workspaces/ghost/.yarncache
|
|
|
|
EXPOSE 2368
|
|
EXPOSE 4200
|
|
EXPOSE 4173
|
|
EXPOSE 41730
|
|
EXPOSE 4175
|
|
EXPOSE 4176
|
|
EXPOSE 4177
|
|
EXPOSE 4178
|
|
EXPOSE 6174
|
|
EXPOSE 7173
|
|
EXPOSE 7174
|
|
|
|
|
|
# Full Devcontainer Stage: Add the code and install dependencies
|
|
### 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
|
|
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
|
|
|
|
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"]
|
|
CMD ["yarn", "dev"]
|