# 1. A: Define a base image # FROM python:3.12 # FROM alpine:3.22.1 FROM alpine:latest # FROM debian:bookworm-slim # 1. B: Set ENV Variables ENV PYTHON_VERSION=3.12 ENV JAVA_VERSION=22.0.2 ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV PYENV_ROOT="/opt/pyenv" ENV PATH="${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:${PATH}" # 2. Set the working directory inside the container WORKDIR /app # 3. Copy the requirements and src files COPY requirements.txt . COPY package.json . COPY src/* . # 4. A: Install dependencies # RUN apt update # RUN apt install -y pkg-config curl clang gopls git libgirepository1.0-dev libssl-dev libcairo2-dev RUN apk update RUN apk add --no-cache \ nodejs \ npm \ bash \ bash-completion \ curl \ clang \ pkgconf \ make \ git \ gopls \ linux-headers \ build-base \ openssh \ tzdata \ openssl-dev \ bzip2-dev \ zlib-dev \ xz-dev \ sqlite-dev \ readline-dev \ libffi-dev \ gdbm-dev \ gobject-introspection-dev \ cairo-dev RUN curl -fsSL https://pyenv.run | bash RUN pyenv install ${PYTHON_VERSION} && pyenv global ${PYTHON_VERSION} && pyenv local ${PYTHON_VERSION} RUN pip install --no-cache-dir -r requirements.txt # 4. B: Install nvm and node # RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash # RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} # RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION} # RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION} RUN node --version RUN npm --version RUN npm install # 5. A: Remove dependencies RUN apk del \ linux-headers \ build-base \ openssh \ tzdata \ openssl-dev \ bzip2-dev \ zlib-dev \ xz-dev \ sqlite-dev \ readline-dev \ libffi-dev \ gdbm-dev \ gobject-introspection-dev \ cairo-dev RUN rm -rf /tmp/* RUN rm -rf /opt/nvm/.cache RUN rm /app/requirements.txt # 6. Expose Port and define the command used to run the app EXPOSE 9999 CMD ["npm", "run", "start-verbose"]