-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
279f175
commit 4c5b421
Showing
3 changed files
with
86 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# syntax=docker/dockerfile:1.2 | ||
|
||
# Good base image to start from for most development | ||
# Stage 1: Node.js environment setup for NestJS | ||
FROM node:20.10.0-slim AS node-build | ||
|
||
# Please remember, the base image we use /must be as small as possible/ for the best | ||
# production deployments. This is not optional. | ||
|
||
WORKDIR /workspace | ||
|
||
# The official Debian/Ubuntu Docker Image automatically removes the cache by default! | ||
# Removing the docker-clean file manages that issue. | ||
RUN rm -rf /etc/apt/apt.conf.d/docker-clean | ||
|
||
COPY ./bin/builds/ . | ||
|
||
# Switch to non-root user | ||
RUN mkdir /home/.npm | ||
RUN useradd -m appuser && chown -R appuser /workspace && chown -R appuser "/home/.npm" | ||
|
||
RUN --mount=type=cache,target=/var/cache/apt ./install_packages \ | ||
dumb-init \ | ||
htop \ | ||
make \ | ||
g++ \ | ||
python3 | ||
|
||
ENV PATH=/root/.local/bin:$PATH | ||
COPY package-lock.json . | ||
COPY package.json . | ||
RUN --mount=type=cache,target=/root/.cache npm ci | ||
|
||
USER appuser | ||
|
||
# Copy project files | ||
COPY . . | ||
|
||
RUN npm run build | ||
|
||
# Stage 2: Python environment setup | ||
FROM python:3.12-slim AS python-build | ||
|
||
WORKDIR /app | ||
|
||
# Install git | ||
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* | ||
|
||
# Clone the Python repository | ||
RUN git clone https://github.com/freemocap/skellybot-analysis | ||
|
||
# Change to the directory of the cloned repository | ||
WORKDIR /app/skellybot-analysis | ||
|
||
# Install dependencies | ||
RUN pip install . | ||
|
||
# Stage 3: Final image | ||
FROM node:20.10.0-slim | ||
|
||
# Recreate the appuser in the final stage | ||
RUN useradd -m appuser | ||
|
||
# Ensure dumb-init is installed | ||
RUN apt-get update && apt-get install -y dumb-init && rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy Node.js build artifacts | ||
COPY --from=node-build /workspace /workspace | ||
|
||
# Copy the Python environment | ||
COPY --from=python-build /app /app | ||
|
||
WORKDIR /workspace | ||
|
||
USER appuser | ||
|
||
ENV NODE_ENV=production | ||
ENV PYTHONPATH="${PYTHONPATH}:/app/skellybot-analysis" | ||
|
||
# Define entrypoint | ||
ENTRYPOINT ["/usr/bin/dumb-init", "--"] | ||
|
||
# Run both Node.js and Python commands | ||
CMD ["sh", "-c", "npm run start:prod & python /app/skellybot-analysis/skellybot_analysis/__main__.py"] |
This file was deleted.
Oops, something went wrong.