Update Docker configuration and entrypoint script. Enhance .dockerignore to include additional files and directories for better management. Remove static file collection from entrypoint and add it to the Dockerfile build process for improved efficiency.

This commit is contained in:
2026-02-07 11:02:05 +03:00
parent a6fa8325cd
commit cb8ace803b
3 changed files with 18 additions and 9 deletions

View File

@@ -19,5 +19,12 @@ yarn-debug.log*
yarn-error.log* yarn-error.log*
Dockerfile Dockerfile
docker-compose.yml docker-compose.yml
docker-compose.dev.yml
README.md README.md
clouds.yaml *.md
clouds.yaml
.env.example
tailwind.config.js
package.json
package-lock.json
dashboard/tests/

View File

@@ -1,23 +1,23 @@
FROM alpine:3 AS build FROM alpine:3.21 AS build
RUN apk update && \ RUN apk update && \
apk add --no-cache --virtual .build-deps \ apk add --no-cache --virtual .build-deps \
ca-certificates gcc postgresql-dev linux-headers musl-dev \ ca-certificates gcc postgresql-dev linux-headers musl-dev \
libffi-dev jpeg-dev zlib-dev \ libffi-dev jpeg-dev zlib-dev \
git bash build-base python3-dev \ build-base python3-dev dos2unix
dos2unix
RUN python3 -m venv /venv RUN python3 -m venv /venv
ENV PATH "/venv/bin:$PATH" ENV PATH "/venv/bin:$PATH"
COPY ./requirements.txt / COPY ./requirements.txt /
RUN pip install -r /requirements.txt RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r /requirements.txt
COPY ./docker-entrypoint.sh /docker-entrypoint.sh COPY ./docker-entrypoint.sh /docker-entrypoint.sh
RUN dos2unix /docker-entrypoint.sh && \ RUN dos2unix /docker-entrypoint.sh && \
chmod +x /docker-entrypoint.sh chmod +x /docker-entrypoint.sh
FROM alpine:3 FROM alpine:3.21
ENV LANG C.UTF-8 ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8 ENV LC_ALL C.UTF-8
@@ -32,6 +32,11 @@ COPY --from=build /docker-entrypoint.sh /docker-entrypoint.sh
WORKDIR /app WORKDIR /app
COPY . /app COPY . /app
ENV DJANGO_SETTINGS_MODULE=watcher_visio.settings
RUN python3 manage.py collectstatic --noinput
RUN adduser -D -g "" app && chown -R app:app /app
USER app
ENTRYPOINT ["/docker-entrypoint.sh"] ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["python3", "manage.py", "runserver", "0.0.0.0:8080"] CMD ["python3", "manage.py", "runserver", "0.0.0.0:8080"]

View File

@@ -4,8 +4,5 @@ set -e
echo "Applying database migrations..." echo "Applying database migrations..."
python3 manage.py migrate --noinput python3 manage.py migrate --noinput
echo "Collecting static files..."
python3 manage.py collectstatic --noinput
echo "Starting Django application..." echo "Starting Django application..."
exec "$@" exec "$@"