Refactor Dockerfile to optimize build stages and switch to Debian-based images

This commit is contained in:
Mathias Wagner
2026-01-22 20:09:29 +01:00
parent c5702795dc
commit 4e865cb231

View File

@@ -6,11 +6,11 @@ RUN npm install --force
COPY ./client ./
RUN npm run build
FROM denoland/deno:alpine
FROM denoland/deno:debian AS server-build
RUN apk add --no-cache tzdata python3 make g++ gcc musl-dev linux-headers
ENV TZ=Etc/UTC
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 make g++ nodejs npm \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /myspeed
@@ -19,6 +19,20 @@ COPY ./deno.json /myspeed/deno.json
RUN deno install --allow-scripts
FROM denoland/deno:debian
RUN apt-get update && apt-get install -y --no-install-recommends \
tzdata \
&& rm -rf /var/lib/apt/lists/*
ENV TZ=Etc/UTC
WORKDIR /myspeed
COPY --from=server-build /myspeed/server /myspeed/server
COPY --from=server-build /myspeed/deno.json /myspeed/deno.json
COPY --from=server-build /myspeed/node_modules /myspeed/node_modules
COPY --from=server-build /deno-dir /deno-dir
COPY --from=client-build /client/build /myspeed/build
VOLUME ["/myspeed/data"]