forked from TryGhost/Ghost
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
227 lines (206 loc) · 10.4 KB
/
Dockerfile
File metadata and controls
227 lines (206 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# Development Dockerfile for Ghost Monorepo
# Not intended for production use. See https://github.com/tryghost/ghost-docker for production-ready self-hosting setup.
ARG NODE_VERSION=22.18.0
# --------------------
# Base Image
# --------------------
FROM node:$NODE_VERSION-bullseye-slim AS base
RUN apt-get update && \
apt-get install -y \
build-essential \
curl \
jq \
libjemalloc2 \
python3 \
tar \
git && \
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-get update && \
apt-get install -y \
stripe && \
rm -rf /var/lib/apt/lists/* && \
apt clean
# --------------------
# Development Base
# --------------------
FROM base AS development-base
WORKDIR /home/ghost
COPY package.json yarn.lock ./
# Calculate a hash of the yarn.lock file
## See development.entrypoint.sh for more info
RUN mkdir -p .yarnhash && md5sum yarn.lock | awk '{print $1}' > .yarnhash/yarn.lock.md5
# Copy all package.json files
COPY apps/admin/package.json apps/admin/package.json
COPY apps/stats/package.json apps/stats/package.json
COPY apps/activitypub/package.json apps/activitypub/package.json
COPY apps/admin-x-design-system/package.json apps/admin-x-design-system/package.json
COPY apps/admin-x-framework/package.json apps/admin-x-framework/package.json
COPY apps/admin-x-settings/package.json apps/admin-x-settings/package.json
COPY apps/announcement-bar/package.json apps/announcement-bar/package.json
COPY apps/comments-ui/package.json apps/comments-ui/package.json
COPY apps/portal/package.json apps/portal/package.json
COPY apps/posts/package.json apps/posts/package.json
COPY apps/shade/package.json apps/shade/package.json
COPY apps/signup-form/package.json apps/signup-form/package.json
COPY apps/sodo-search/package.json apps/sodo-search/package.json
COPY e2e/package.json e2e/package.json
COPY ghost/admin/lib/asset-delivery/package.json ghost/admin/lib/asset-delivery/package.json
COPY ghost/admin/lib/ember-power-calendar-moment/package.json ghost/admin/lib/ember-power-calendar-moment/package.json
COPY ghost/admin/lib/ember-power-calendar-utils/package.json ghost/admin/lib/ember-power-calendar-utils/package.json
COPY ghost/admin/package.json ghost/admin/package.json
COPY ghost/core/package.json ghost/core/package.json
COPY ghost/i18n/package.json ghost/i18n/package.json
COPY ghost/parse-email-address/package.json ghost/parse-email-address/package.json
COPY .github/scripts/install-deps.sh .github/scripts/install-deps.sh
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,id=yarn-cache \
bash .github/scripts/install-deps.sh
# --------------------
# Shade Builder
# --------------------
FROM development-base AS shade-builder
WORKDIR /home/ghost
COPY apps/shade apps/shade
RUN cd apps/shade && yarn build
# --------------------
# parse-email-address Builder
# --------------------
FROM development-base AS parse-email-address-builder
WORKDIR /home/ghost
COPY ghost/parse-email-address ghost/parse-email-address
RUN cd ghost/parse-email-address && yarn build
# --------------------
# Admin-x-design-system Builder
# --------------------
FROM development-base AS admin-x-design-system-builder
WORKDIR /home/ghost
COPY apps/admin-x-design-system apps/admin-x-design-system
RUN cd apps/admin-x-design-system && yarn build
# --------------------
# Admin-x-framework Builder
# --------------------
FROM development-base AS admin-x-framework-builder
WORKDIR /home/ghost
COPY apps/admin-x-framework apps/admin-x-framework
COPY --from=shade-builder /home/ghost/apps/shade/es apps/shade/es
COPY --from=shade-builder /home/ghost/apps/shade/types apps/shade/types
COPY --from=admin-x-design-system-builder /home/ghost/apps/admin-x-design-system/es apps/admin-x-design-system/es
COPY --from=admin-x-design-system-builder /home/ghost/apps/admin-x-design-system/types apps/admin-x-design-system/types
RUN cd apps/admin-x-framework && yarn build
# --------------------
# Stats Builder
# --------------------
FROM development-base AS stats-builder
WORKDIR /home/ghost
COPY apps/stats apps/stats
COPY --from=shade-builder /home/ghost/apps/shade apps/shade
COPY --from=admin-x-design-system-builder /home/ghost/apps/admin-x-design-system/es apps/admin-x-design-system/es
COPY --from=admin-x-design-system-builder /home/ghost/apps/admin-x-design-system/types apps/admin-x-design-system/types
COPY --from=admin-x-framework-builder /home/ghost/apps/admin-x-framework/dist apps/admin-x-framework/dist
COPY --from=admin-x-framework-builder /home/ghost/apps/admin-x-framework/types apps/admin-x-framework/types
RUN cd apps/stats && yarn build
# --------------------
# Posts Builder
# --------------------
FROM development-base AS posts-builder
WORKDIR /home/ghost
COPY apps/posts apps/posts
COPY --from=shade-builder /home/ghost/apps/shade apps/shade
COPY --from=admin-x-design-system-builder /home/ghost/apps/admin-x-design-system/es apps/admin-x-design-system/es
COPY --from=admin-x-design-system-builder /home/ghost/apps/admin-x-design-system/types apps/admin-x-design-system/types
COPY --from=admin-x-framework-builder /home/ghost/apps/admin-x-framework/dist apps/admin-x-framework/dist
COPY --from=admin-x-framework-builder /home/ghost/apps/admin-x-framework/types apps/admin-x-framework/types
RUN cd apps/posts && yarn build
# --------------------
# Portal Builder
# --------------------
FROM development-base AS portal-builder
WORKDIR /home/ghost
COPY ghost/i18n ghost/i18n
COPY apps/portal apps/portal
RUN cd apps/portal && yarn build
# --------------------
# Admin-x-settings Builder
# --------------------
FROM development-base AS admin-x-settings-builder
WORKDIR /home/ghost
COPY apps/admin-x-settings apps/admin-x-settings
COPY --from=shade-builder /home/ghost/apps/shade apps/shade
COPY --from=admin-x-design-system-builder /home/ghost/apps/admin-x-design-system apps/admin-x-design-system
COPY --from=admin-x-framework-builder /home/ghost/apps/admin-x-framework/dist apps/admin-x-framework/dist
COPY --from=admin-x-framework-builder /home/ghost/apps/admin-x-framework/types apps/admin-x-framework/types
COPY ghost/i18n ghost/i18n
RUN cd apps/admin-x-settings && yarn build
# --------------------
# Activitypub Builder
# --------------------
FROM development-base AS activitypub-builder
WORKDIR /home/ghost
COPY apps/activitypub apps/activitypub
COPY ghost/core/core/frontend/src/cards ghost/core/core/frontend/src/cards
COPY --from=shade-builder /home/ghost/apps/shade apps/shade
COPY --from=admin-x-design-system-builder /home/ghost/apps/admin-x-design-system/es apps/admin-x-design-system/es
COPY --from=admin-x-design-system-builder /home/ghost/apps/admin-x-design-system/types apps/admin-x-design-system/types
COPY --from=admin-x-framework-builder /home/ghost/apps/admin-x-framework/dist apps/admin-x-framework/dist
COPY --from=admin-x-framework-builder /home/ghost/apps/admin-x-framework/types apps/admin-x-framework/types
RUN cd apps/activitypub && yarn build
# --------------------
# Admin Ember Builder
# --------------------
FROM development-base AS admin-ember-builder
WORKDIR /home/ghost
COPY ghost/admin ghost/admin
# Admin's asset-delivery pipeline needs the ghost module to resolve
COPY ghost/core/package.json ghost/core/package.json
COPY ghost/core/index.js ghost/core/index.js
COPY --from=stats-builder /home/ghost/apps/stats/dist apps/stats/dist
COPY --from=posts-builder /home/ghost/apps/posts/dist apps/posts/dist
COPY --from=admin-x-settings-builder /home/ghost/apps/admin-x-settings/dist apps/admin-x-settings/dist
COPY --from=activitypub-builder /home/ghost/apps/activitypub/dist apps/activitypub/dist
RUN mkdir -p ghost/core/core/built/admin && cd ghost/admin && yarn build
# --------------------
# Admin React Builder
# --------------------
FROM development-base AS admin-react-builder
WORKDIR /home/ghost
COPY apps/admin apps/admin
COPY ghost/core/core/frontend/src/cards ghost/core/core/frontend/src/cards
# React admin needs full dependencies for workspace linking
COPY --from=shade-builder /home/ghost/apps/shade apps/shade
COPY --from=admin-x-design-system-builder /home/ghost/apps/admin-x-design-system apps/admin-x-design-system
COPY --from=admin-x-framework-builder /home/ghost/apps/admin-x-framework apps/admin-x-framework
COPY --from=posts-builder /home/ghost/apps/posts apps/posts
COPY --from=stats-builder /home/ghost/apps/stats apps/stats
COPY --from=admin-x-settings-builder /home/ghost/apps/admin-x-settings apps/admin-x-settings
COPY --from=activitypub-builder /home/ghost/apps/activitypub apps/activitypub
COPY ghost/i18n ghost/i18n
# React admin needs the built Ember admin (vite-ember-assets plugin reads it at build time)
COPY --from=admin-ember-builder /home/ghost/ghost/core/core/built/admin ghost/core/core/built/admin
RUN cd apps/admin && yarn build
# --------------------
# Ghost Assets Builder
# --------------------
FROM development-base AS ghost-assets-builder
WORKDIR /home/ghost
COPY ghost/core ghost/core
RUN cd ghost/core && yarn build:assets
# --------------------
# Development
# --------------------
FROM development-base AS development
COPY . .
COPY --from=ghost-assets-builder /home/ghost/ghost/core/core/frontend/public ghost/core/core/frontend/public
COPY --from=shade-builder /home/ghost/apps/shade/es apps/shade/es
COPY --from=shade-builder /home/ghost/apps/shade/types apps/shade/types
COPY --from=admin-x-design-system-builder /home/ghost/apps/admin-x-design-system/es apps/admin-x-design-system/es
COPY --from=admin-x-design-system-builder /home/ghost/apps/admin-x-design-system/types apps/admin-x-design-system/types
COPY --from=admin-x-framework-builder /home/ghost/apps/admin-x-framework/dist apps/admin-x-framework/dist
COPY --from=admin-x-framework-builder /home/ghost/apps/admin-x-framework/types apps/admin-x-framework/types
COPY --from=stats-builder /home/ghost/apps/stats/dist apps/stats/dist
COPY --from=posts-builder /home/ghost/apps/posts/dist apps/posts/dist
COPY --from=portal-builder /home/ghost/apps/portal/umd apps/portal/umd
COPY --from=admin-x-settings-builder /home/ghost/apps/admin-x-settings/dist apps/admin-x-settings/dist
COPY --from=activitypub-builder /home/ghost/apps/activitypub/dist apps/activitypub/dist
COPY --from=admin-react-builder /home/ghost/ghost/core/core/built/admin ghost/core/core/built/admin
COPY --from=parse-email-address-builder /home/ghost/ghost/parse-email-address/build ghost/parse-email-address/build
CMD ["yarn", "dev"]