mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-30 22:34:01 -05:00
cabee005f4
ref https://linear.app/ghost/issue/ENG-1785/consolidate-dev-container-composeyml-with-the-root-level-composeyml - We currently have two compose.yml files: - `.devcontainer/compose.yml`: used for the Dev Container - `compose.yml`: used for local development with docker compose - The Dev Container compose file does need some additional configuration, but most of this code is duplicated from the root level compose.yml file - This commit removes this duplication by using both compose files in the Dev Container setup, so it will base the compose configuration on the root level, and then extend it with the Dev Container specific configuration - This way any updates to the root level compose file will also be available and reflected in the Dev Container setup without having to make the change twice.
67 lines
2.1 KiB
Docker
67 lines
2.1 KiB
Docker
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 && \
|
|
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 \
|
|
procps \
|
|
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 $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 $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"]
|
|
CMD ["yarn", "dev"]
|