diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..600e365e --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +**/node_modules \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index c4a401bb..9ce1bcec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,40 +1,68 @@ -FROM node:19-alpine AS build +FROM node:19-bullseye-slim AS build -RUN addgroup -S app && adduser -S app -G app -RUN mkdir /app && chown app:app /app - -RUN apk add --update --no-cache git - -USER app +RUN apt-get update && \ + apt-get install -y \ + git +# Set working directory WORKDIR /app +# Copy package.json and tsconfig.json COPY ./app/package.json ./ COPY ./app/tsconfig.json ./ +# Install Node.js dependencies RUN npm install +# Copy craco.config.js, public, and src directories COPY ./app/craco.config.js ./craco.config.js COPY ./app/public ./public COPY ./app/src ./src +# Set environment variables ENV NODE_ENV=production -ENV REACT_APP_AUTH_PROVIDER=local +# Build the application RUN npm run build -FROM node:19-alpine AS server - -RUN addgroup -S app && adduser -S app -G app +FROM nvidia/cuda:12.1.0-devel-ubuntu20.04 AS server +# Set the working directory WORKDIR /app -COPY ./server/package.json ./ -COPY ./server/tsconfig.json ./ - -RUN apk add --update --no-cache python3 py3-pip make g++ git +# Update the package index and install required dependencies +RUN apt-get update && \ + apt-get install -y \ + curl \ + build-essential \ + libssl-dev \ + libffi-dev \ + python3-dev \ + python3-pip \ + openssl + +RUN mkdir /usr/local/nvm +ENV NVM_DIR /usr/local/nvm +ENV NODE_VERSION 19.9.0 +RUN curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + +ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules +ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH + +# Copy package.json and requirements.txt into the working directory +COPY ./server/package.json ./server/requirements.txt ./server/tsconfig.json ./ + +# Install Node.js dependencies from package.json RUN npm install +# Install Python dependencies from requirements.txt +RUN pip3 install --no-cache-dir -r requirements.txt + +# Copy the rest of the application code into the working directory COPY ./server/src ./src RUN CI=true sh -c "cd /app && mkdir data && npm run start && rm -rf data" diff --git a/app/craco.config.js b/app/craco.config.js index 020e688d..2e6c13ce 100644 --- a/app/craco.config.js +++ b/app/craco.config.js @@ -1,5 +1,6 @@ const cracoWasm = require("craco-wasm"); const webpack = require("webpack"); +const path = require("path"); module.exports = { plugins: [ @@ -26,12 +27,17 @@ module.exports = { fallback: { buffer: require.resolve("buffer"), }, + alias: { + '@ffmpeg/ffmpeg': path.resolve(__dirname, 'src/stub.js') + }, }, plugins: [ new webpack.ProvidePlugin({ Buffer: ["buffer", "Buffer"], }), ], + ignoreWarnings: [/Failed to parse source map/], + cache: false, }, }, } \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 65b81dc9..00000000 --- a/docker-compose.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: '3' - -services: - app: - build: - context: . - dockerfile: Dockerfile - working_dir: /app - volumes: - - ./data:/app/data - command: npm run start - ports: - - 3000:3000 - environment: - - PORT=3000 - - WEBAPP_PORT=3000 \ No newline at end of file