Skip to content

Commit

Permalink
fix: docker ci build
Browse files Browse the repository at this point in the history
  • Loading branch information
stolpeo committed Dec 5, 2024
1 parent b512830 commit ffbf839
Showing 1 changed file with 32 additions and 35 deletions.
67 changes: 32 additions & 35 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
FROM python:3.8-buster
FROM python:3.10-bookworm AS base

MAINTAINER Oliver Stolpe <[email protected]>
LABEL org.opencontainers.image.source https://github.com/bihealth/kiosc-server
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1

WORKDIR /usr/src/app

ARG app_git_url=https://github.com/bihealth/kiosc-server.git
ARG app_git_tag
ARG app_git_depth=1
LABEL org.opencontainers.image.authors="Oliver Stolpe <[email protected]>"
LABEL org.opencontainers.image.source https://github.com/bihealth/kiosc-server

ENV DEBIAN_FRONTEND noninteractive
ENV CUSTOM_STATIC_DIR /usr/src/app/local-static
# As long as we serve from internal cubi-gitlab via SSH.
ENV GIT_SSH_COMMAND "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"

## Add the wait script to the image
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.7.3/wait /usr/local/bin/wait
RUN chmod +x /usr/local/bin/wait

# Copy source code into Docker image.
RUN mkdir -p /usr/src
RUN git clone --depth $app_git_depth --branch $app_git_tag $app_git_url /usr/src/app

# Install system dependencies.
RUN apt-get update && \
apt-get install -y \
Expand All @@ -32,57 +27,59 @@ RUN apt-get update && \
postgresql-client \
wget

RUN apt-get clean autoclean && \
apt-get autoremove --yes && \
rm -rf /var/lib/{apt,dpkg,cache,log}/

# Copy the project files.
COPY . .

# Install Python dependencies.
RUN cd /usr/src/app && \
pip install --use-deprecated=legacy-resolver --no-cache-dir -r requirements/production.txt && \
RUN pip install --use-deprecated=legacy-resolver --no-cache-dir -r requirements/production.txt && \
pip install --use-deprecated=legacy-resolver --no-cache-dir -r requirements/local.txt && \
pip install --use-deprecated=legacy-resolver --no-cache-dir -r requirements/ldap.txt && \
pip install --use-deprecated=legacy-resolver celery # appears to be missing

# Download files from CDN.
RUN mkdir -p /usr/src/app/local-static/local/css && \
mkdir -p /usr/src/app/local-static/local/fonts && \
mkdir -p /usr/src/app/local-static/local/js && \
cd /usr/src/app/local-static/local/fonts && \
wget \
RUN mkdir -p local-static/local/css && \
mkdir -p local-static/local/fonts && \
mkdir -p local-static/local/js && \
wget -P local-static/local/fonts \
https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/FontAwesome.otf \
https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.eot \
https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.svg \
https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.ttf \
https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.woff \
https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.woff2 && \
\
cd /usr/src/app/local-static/local/css && \
wget \
https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.woff2 \
&& \
wget -P local-static/local/css \
https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css \
https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css && \
\
cd /usr/src/app/local-static/local/js && \
wget \
https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css \
&& \
wget -P local-static/local/js \
https://code.jquery.com/jquery-3.5.1.min.js \
https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js \
https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.4/js/tether.js \
https://cdnjs.cloudflare.com/ajax/libs/shepherd/1.8.1/js/shepherd.min.js \
https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js

# Get icons
RUN cd /usr/src/app && \
DJANGO_SECRET_KEY=for-build-only \
RUN DJANGO_SECRET_KEY=for-build-only \
DJANGO_SETTINGS_MODULE=config.settings.production \
DATABASE_URL=postgres://kiosc:kiosc@fake/kiosc \
python manage.py geticons -c octicon eos-icons

# Prepare static files
RUN cd /usr/src/app && \
DJANGO_SECRET_KEY=for-build-only \
RUN DJANGO_SECRET_KEY=for-build-only \
DJANGO_SETTINGS_MODULE=config.settings.production \
DATABASE_URL=postgres://kiosc:kiosc@fake/kiosc \
python manage.py collectstatic --no-input

# Define the entry point.
COPY docker-entrypoint.sh /usr/local/bin

COPY docker/docker-entrypoint.sh /usr/local/bin
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
ln -s /usr/local/bin/docker-entrypoint.sh / # backwards compat
ENTRYPOINT ["docker-entrypoint.sh"]
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["asgi"]
EXPOSE 8080/tcp

0 comments on commit ffbf839

Please sign in to comment.