Skip to content

Commit

Permalink
Add lang to HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
koldakov committed Jun 11, 2024
1 parent 12a5b2f commit 5b98f9d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 28 deletions.
65 changes: 38 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,57 @@
FROM python:3.12.0-slim-bullseye
FROM python:3.12.0-slim-bullseye as python-base

# Environ
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV VIRTUAL_ENV=/opt/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PATH="${PATH}:/root/.local/bin" \
POETRY_HOME=/opt/poetry \
POETRY_VENV=/opt/poetry-venv \
POETRY_CACHE_DIR=/opt/.cache

RUN curl -sSL https://install.python-poetry.org | python3 -

# Arguments
ARG APP_USER=qworpa
ARG WORK_DIR=/app
ARG APP_USER=userapp

# Install OS dependencies
COPY install-dependencies.sh /tmp
RUN . /tmp/install-dependencies.sh
# Install dependencies
RUN apt-get update
RUN apt-get -y install make

# Install python environ
RUN python3 -m venv $VIRTUAL_ENV
COPY requirements.txt /tmp
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Create stage for Poetry installation
FROM python-base as poetry-base

# Add user
RUN groupadd \
--system ${APP_USER} \
&& useradd --no-log-init --system --gid ${APP_USER} ${APP_USER}
# Creating a virtual environment just for poetry and install it with pip
RUN python3 -m venv $POETRY_VENV \
&& $POETRY_VENV/bin/pip install poetry

# Create a new stage from the base python image
FROM python-base as futuramaapi-app

ARG WORK_DIR=/app

# Copy project files to the work dir
COPY ./ ${WORK_DIR}
# Copy Poetry to app image
COPY --from=poetry-base ${POETRY_VENV} ${POETRY_VENV}

# Set owner to the project
RUN chown -R ${APP_USER}:${APP_USER} ${WORK_DIR}
# Add Poetry to PATH
ENV PATH="${PATH}:${POETRY_VENV}/bin"

# Set work dir
WORKDIR ${WORK_DIR}

# Copy Dependencies
COPY . ${WORK_DIR}

# Install Dependencies
RUN poetry install --no-interaction --no-cache --without dev --without test

EXPOSE 8000

# Add user
RUN groupadd \
--system ${APP_USER} \
&& useradd --no-log-init --system --gid ${APP_USER} ${APP_USER}

# Set project user
USER ${APP_USER}:${APP_USER}

# Compile messages
RUN cd ${WORK_DIR}; make messages-compile

# Main launch command
CMD ["./docker-entrypoint.sh"]
2 changes: 1 addition & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand Down

0 comments on commit 5b98f9d

Please sign in to comment.