Skip to content

Commit

Permalink
Merge pull request quipucords#2129 from bruno-fs/update-base-image
Browse files Browse the repository at this point in the history
Update base image
  • Loading branch information
gtanzillo committed Feb 9, 2022
2 parents e3e3b47 + cf5fa25 commit 9fde45f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 44 deletions.
43 changes: 14 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
FROM fedora:26
FROM redhat/ubi8

RUN dnf -y groupinstall "Development tools" \
&& dnf -y install python-devel python-tools python3-devel python3-tools sshpass which supervisor procps\
&& dnf clean all \
&& rm -rf /var/cache/dnf
RUN dnf -yq install python39 make openssh-clients glibc-langpack-en &&\
dnf clean all &&\
python3 -m venv /opt/venv

RUN pip install --no-cache-dir virtualenv
RUN virtualenv -p python3 ~/venv
# Create base directory
RUN mkdir -p /app
ENV PATH="/opt/venv/bin:${PATH}"

# Setup dependencies
COPY requirements.txt /app/requirements.txt
RUN . ~/venv/bin/activate; pip install -r /app/requirements.txt gunicorn==20.0.4
RUN pip install --upgrade pip

WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt

# Create /etc/ssl/qpc
RUN mkdir -p /etc/ssl/qpc/
VOLUME /etc/ssl/qpc/
COPY deploy/ssl/server.crt /etc/ssl/qpc/
COPY deploy/ssl/server.csr /etc/ssl/qpc/
COPY deploy/ssl/server.key /etc/ssl/qpc/

COPY deploy/ssl/* /etc/ssl/qpc/

# Create /deploy
RUN mkdir -p /deploy
Expand All @@ -29,17 +23,10 @@ COPY deploy/docker_run.sh /deploy
COPY deploy/server_run.sh /deploy
COPY deploy/setup_user.py /deploy

# Config supervisor
COPY deploy/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Create log directories
RUN mkdir -p /var/log/supervisor/
VOLUME /var/log

# Create /sshkeys
RUN mkdir -p /sshkeys
VOLUME /sshkeys

# Create /var/data
RUN mkdir -p /var/data
VOLUME /var/data
Expand All @@ -50,9 +37,7 @@ COPY quipucords/scanner/network/runner/roles/ /etc/ansible/roles/
VOLUME /etc/ansible/roles/

# Copy server code
COPY . /app/
WORKDIR /app
VOLUME /app
COPY . .

# Set production environment
ARG BUILD_COMMIT=master
Expand All @@ -68,10 +53,10 @@ ENV DJANGO_LOG_FILE=/var/log/app.log
ENV QUIPUCORDS_LOGGING_LEVEL=INFO
ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV PYTHONHASHSEED=0
ENV PYTHONPATH=/app/quipucords

# Initialize database & Collect static files
RUN . ~/venv/bin/activate;make server-static
RUN make server-static
RUN ls -lta /var/data

WORKDIR /var/log
Expand Down
8 changes: 1 addition & 7 deletions deploy/docker_run.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#!/usr/bin/env bash
eval `ssh-agent -s`

if [[ ${USE_SUPERVISORD,,} = "false" ]]; then
echo "Running without supervisord"
/deploy/server_run.sh >& /var/log/quipucords.log
else
echo "Running with supervisord"
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi
/deploy/server_run.sh 2>&1 | tee /var/log/quipucords.log
8 changes: 1 addition & 7 deletions deploy/server_run.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#!/usr/bin/env bash

source ~/venv/bin/activate

make server-migrate server-set-superuser -C /app

if [[ ${USE_SUPERVISORD,,} = "false" ]]; then
cd /app/quipucords
fi

~/venv/bin/gunicorn quipucords.wsgi -c /deploy/gunicorn.conf.py
gunicorn quipucords.wsgi -c /deploy/gunicorn.conf.py
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ PyYAML==5.4
requests==2.25.1
whitenoise==5.2.0
psycopg2-binary==2.8.6
ansible-runner==1.4.6
ansible-runner==1.4.6
gunicorn==20.0.4

0 comments on commit 9fde45f

Please sign in to comment.