Refactor Dockerfile and entrypoint script; add Makefile for build and test commands

This commit is contained in:
2026-04-20 08:10:12 +02:00
parent 987466e11d
commit e3f492ded5
3 changed files with 10 additions and 11 deletions
+1 -10
View File
@@ -4,14 +4,9 @@ ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
WORKDIR /app WORKDIR /app
RUN adduser -D -S app
COPY requirements.txt /app/ COPY requirements.txt /app/
RUN apk --no-cache update && apk --no-cache upgrade RUN apk --no-cache update && apk --no-cache upgrade
RUN apk add --no-cache --virtual .build-deps build-base mariadb-dev libffi-dev \ RUN pip install --no-cache-dir -r requirements.txt
&& apk add --no-cache mariadb-connector-c \
&& pip install --no-cache-dir -r requirements.txt \
&& apk del .build-deps
COPY . /app/ COPY . /app/
RUN chmod +x /app/entrypoint.sh RUN chmod +x /app/entrypoint.sh
@@ -21,8 +16,4 @@ EXPOSE 8000
RUN mkdir -pv /fonts RUN mkdir -pv /fonts
COPY tienda/static/fonts/ /fonts/ COPY tienda/static/fonts/ /fonts/
RUN chown -R app: /app /fonts
RUN chmod 770 /app/entrypoint.sh
USER app
ENTRYPOINT ["/bin/sh", "/app/entrypoint.sh"] ENTRYPOINT ["/bin/sh", "/app/entrypoint.sh"]
+6
View File
@@ -0,0 +1,6 @@
docker:
docker build -t ghcr.io/dsaub/proyecto-mvc:development .
docker push ghcr.io/dsaub/proyecto-mvc:development
test:
./manage.py test
+3 -1
View File
@@ -1,11 +1,13 @@
#!/bin/sh #!/bin/sh
set -eu
echo "Sleeping due to mysql..." echo "Sleeping due to mysql..."
sleep 10 sleep 10
echo "Running DB migrations..." echo "Running DB migrations..."
python manage.py migrate python manage.py migrate
echo "Collecting STATIC..." echo "Collecting STATIC..."
python manage.py collectstatic --noinput python manage.py collectstatic --noinput --clear
echo "Running server!" echo "Running server!"