-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (32 loc) · 1.56 KB
/
Copy pathDockerfile
File metadata and controls
46 lines (32 loc) · 1.56 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
# ── Builder ──────────────────────────────────────────────────────────────────
FROM node:20 AS builder
ENV METEOR_ALLOW_SUPERUSER=true
ENV PATH="/root/.meteor:${PATH}"
# Install Meteor
RUN curl https://install.meteor.com/ | sh
WORKDIR /app
# Cache npm deps layer before copying full source
COPY app/package.json app/package-lock.json ./app/
RUN cd app && npm ci --legacy-peer-deps
# Copy full Meteor app source (node_modules and .meteor/local excluded via .dockerignore)
COPY app/ ./app/
# Build server-only production bundle
RUN cd app && meteor build /build --architecture os.linux.x86_64 --server-only
# Extract bundle and install server npm dependencies
RUN cd /build \
&& tar -xzf app.tar.gz \
&& cd bundle/programs/server \
&& npm install --omit=dev
# ── Runner ────────────────────────────────────────────────────────────────────
FROM node:20-slim AS runner
# Copy the extracted bundle to /built_app (the non-tar branch in start.sh.internal)
COPY --from=builder /build/bundle/ /built_app/
# Stub out setup_nvm.sh — node is already available in this image
RUN mkdir -p /home/app/scripts \
&& echo '#!/bin/sh' > /home/app/scripts/setup_nvm.sh \
&& chmod +x /home/app/scripts/setup_nvm.sh
COPY start.sh.internal /start.sh
RUN chmod +x /start.sh
WORKDIR /built_app
EXPOSE 3000
CMD ["/start.sh"]