Docker move to alpine; moved sub README to servers

This commit is contained in:
2025-11-25 16:30:45 -06:00
parent cc41036174
commit 15fdb43193
4 changed files with 85 additions and 16 deletions

View File

@@ -1,13 +1,19 @@
# 1. A: Use an existing Python image
FROM python:3.12
# 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}"
ENV NODE_VERSION=24.9.0
ENV NVM_DIR=/root/.nvm
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
# 2. Set the working directory inside the container
WORKDIR /app
@@ -17,20 +23,72 @@ COPY requirements.txt .
COPY package.json .
COPY src/* .
# 4. A: Install the dependencies
RUN apt update
RUN apt install -y curl libgirepository1.0-dev
# 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 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. Expose Port and define the command used to run the app
# 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"]