-
Notifications
You must be signed in to change notification settings - Fork 923
Expand file tree
/
Copy pathDockerfile
More file actions
125 lines (96 loc) · 3.07 KB
/
Dockerfile
File metadata and controls
125 lines (96 loc) · 3.07 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
ARG NODE_VERSION=22.13.0
FROM node:${NODE_VERSION} AS base
WORKDIR /app
ENV NODE_ENV="production" \
PUPPETEER_CACHE_DIR=/app/.cache \
DISPLAY=:10 \
PATH="/usr/bin:/app/selenium/driver:${PATH}" \
CHROME_BIN=/usr/bin/chromium \
CHROME_PATH=/usr/bin/chromium
LABEL org.opencontainers.image.source="https://github.com/steel-dev/steel-browser"
# Install dependencies
RUN rm -f /etc/apt/apt.conf.d/docker-clean; \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache; \
apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get -yq dist-upgrade
# Stage 1: Build UI
FROM node:${NODE_VERSION} AS ui-build
WORKDIR /app
# Copy root workspace files for UI build
COPY --link package.json package-lock.json ./
COPY --link ui/ ./ui/
# Install UI dependencies and build with correct base path
RUN npm ci --include=dev -w ui --ignore-scripts
RUN VITE_API_URL="" VITE_WS_URL="" npm run build -w ui -- --base=/ui
# Stage 2: Build API
FROM base AS api-build
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
pkg-config \
python-is-python3 \
xvfb
# Copy root workspace files for API build
COPY --link package.json package-lock.json ./
# Remove or override the prepare script to avoid husky in Docker
RUN npm pkg set scripts.prepare="echo skip husky"
COPY --link api/ ./api/
# Install dependencies for API
RUN npm ci --include=dev --workspace=api
# Install dependencies for recorder extension separately
RUN cd api/extensions/recorder && npm ci --include=dev && cd -
# Build the API package
RUN npm run build -w api
# Build the recorder extension
RUN cd api/extensions/recorder && \
npm run build && \
cd -
# Prune dev dependencies
RUN npm prune --omit=dev -w api
RUN cd api/extensions/recorder && npm prune --omit=dev && cd -
# Stage 3: Production
FROM base AS production
# Install production dependencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
wget \
nginx \
gnupg \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
fonts-freefont-ttf \
libxss1 \
xvfb \
curl \
unzip \
default-jre \
dbus \
dbus-x11 \
procps \
x11-xserver-utils
# Install Chrome and ChromeDriver
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
wget \
ca-certificates \
curl \
unzip \
# Download and install Chromium
&& apt-get install -y chromium chromium-driver \
# Clean up
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/apt/*
RUN mkdir -p /files
# Copy the built API from api-build stage
COPY --from=api-build /app /app
# Copy the built UI from ui-build stage into the API container
COPY --from=ui-build /app/ui/dist /app/ui/dist
# Copy entrypoint script
COPY --chmod=755 api/entrypoint.sh /app/api/entrypoint.sh
EXPOSE 3000 9223
ENV HOST_IP=localhost \
DBUS_SESSION_BUS_ADDRESS=autolaunch:
ENTRYPOINT ["/app/api/entrypoint.sh"]