Commit 861b7885 authored by Naum Spaseski's avatar Naum Spaseski
Browse files

Added webserver

parent 76f83359
Loading
Loading
Loading
Loading

Dockerfile

0 → 100644
+53 −0
Original line number Original line Diff line number Diff line
FROM ubuntu:24.04
LABEL maintainer="ETSI CTI - cti_support@etsi.org"

# Set UTF-8 locale early to avoid Python fs_encoding errors
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV TZ=Europe/Paris

# Set timezone and install packages
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
    apt-get update -y && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y \
        locales \
        python3-pip \
        python3-dev \
        python3-venv \
        build-essential \
        curl \
        libreoffice-common

# Set up UTF-8 locale
RUN sed -i 's/^# *en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
    locale-gen && \
    echo "export LANG=en_US.UTF-8" >> /etc/profile && \
    echo "export LANGUAGE=en_US.UTF-8" >> /etc/profile && \
    echo "export LC_ALL=en_US.UTF-8" >> /etc/profile

ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

# Copy app source code
COPY templates/ /app/templates/
COPY static/ /app/static/
COPY web_server.py /app/web_server.py
COPY spec2md.py /app/spec2md.py
COPY gridTable.py /app/gridTable.py
COPY config.ini /app/config.ini

COPY requirements_web.txt /app/requirements.txt
WORKDIR /app

# Install Python dependencies
RUN python -m pip install --upgrade pip && \
    python -m pip install -r requirements.txt

# Create upload folder
RUN mkdir -p /app/upload

EXPOSE 5005
# Default command
ENTRYPOINT ["python3"]
CMD ["web_server.py"]

reload.sh

0 → 100755
+28 −0
Original line number Original line Diff line number Diff line
#!/bin/bash
# Copyright ETSI
# See LICENSE files
#
# Stops or restarts the Docker image containing the web-app for spec2md
#

CNT=$(docker ps | grep spec2md | cut -d " " -f1)

if [ "$CNT" != "" ] ; then
    docker stop "$CNT"
fi

if [ "$2" == "stop" ] ; then
    exit 0
fi 

if [ -f env ] ; then
    sed -i -E "s/(LAST_COMMIT=).+/\1$(git rev-parse HEAD)/" env
fi

docker build --no-cache --tag forge.etsi.org:5050/cti/spec2md:$1 -f Dockerfile .

if [ -f env ] ; then
    docker run -d --restart unless-stopped -t -p 5005:5005 --env-file ./env forge.etsi.org:5050/cti/spec2md:$1
else
    docker run -d --restart unless-stopped -t -p 5005:5005 forge.etsi.org:5050/cti/spec2md:$1
fi

requirements_web.txt

0 → 100644
+12 −0
Original line number Original line Diff line number Diff line
# Web server dependencies for spec2md
Flask>=2.0.0
Werkzeug>=2.0.0

# spec2md dependencies (from requirements.txt)
lxml==4.9.3
markdown-it-py==3.0.0
mdurl==0.1.2
pygments==2.17.2
python-docx==1.1.0
rich==13.7.0
typing-extensions==4.8.0

static/etsi_logo.jpg

0 → 100644
+32.4 KiB
Loading image diff...

static/favicon.ico

0 → 100644
+1.12 KiB
Loading image diff...
Loading