blockerbugs/Dockerfile

68 lines
No EOL
2.4 KiB
Docker

# This will produce an image to be used in Openshift
# Build should be triggered from repo root like:
# podman build -f Dockerfile --tag <IMAGE_TAG>
# Don't forget to mount persistent volume for development
# podman run --volume hostdir:/bbugs -ti -u 0 -p 5001:5001 <IMAGE_TAG>
# On OpenShift, edit Deployment Configs, add:
# spec:
# volumes:
# - name: run-volume
# emptyDir: {}
# containers:
# volumeMounts:
# - name: run-volume
# mountPath: /run
FROM fedora:32
LABEL \
name="BlockerBugs application" \
vendor="Fedora QE" \
license="GPLv2+" \
description="Web front end to the currently proposed blocker and freeze exception bugs for Fedora releases under development." \
usage="" \
build-date=""
USER root
COPY ./blockerbugs.spec /opt/app-root/src/blockerbugs/blockerbugs.spec
# install dependencies defined in RPM spec file
RUN dnf -y install findutils rpm-build python3-pip python3-mod_wsgi python3-pycurl \
&& rpm --query --requires --specfile /opt/app-root/src/blockerbugs/blockerbugs.spec | xargs -d '\n' dnf -y install
COPY . /opt/app-root/src/blockerbugs/
# install using --no-deps option to ensure nothing comes from PyPi
RUN pip3 install --no-deps /opt/app-root/src/blockerbugs/
# fix apache config for container use
RUN sed -i 's#^WSGISocketPrefix .*#WSGISocketPrefix /tmp/wsgi#' /opt/app-root/src/blockerbugs/conf/blockerbugs.conf
# install launch script
RUN install -p -m 0755 /opt/app-root/src/blockerbugs/container_start.sh /usr/bin/container_start
# config files
RUN install -d /usr/share/blockerbugs/conf \
&& install -p -m 0644 /opt/app-root/src/blockerbugs/conf/blockerbugs.conf /usr/share/blockerbugs/conf/ \
&& install -p -m 0644 /opt/app-root/src/blockerbugs/conf/blockerbugs.wsgi /usr/share/blockerbugs/ \
&& install -d /etc/blockerbugs \
&& install -p -m 0644 /opt/app-root/src/blockerbugs/conf/blockerbugs.conf /etc/httpd/conf.d/
# alembic
RUN install -p -m 0644 /opt/app-root/src/blockerbugs/alembic.ini /usr/share/blockerbugs/alembic.ini
RUN cp -a /opt/app-root/src/blockerbugs/alembic /usr/share/blockerbugs/alembic
RUN chmod -R 0755 /usr/share/blockerbugs/alembic
# clean up
RUN rm -rf /opt/app-root/src/blockerbugs \
&& dnf -y autoremove findutils rpm-build \
&& dnf clean all
# EXPOSE 5001/tcp
EXPOSE 5001
# Persistent VOLUME
VOLUME [ "/bbugs" ]
CMD [ "runserver" ]
ENTRYPOINT [ "/usr/bin/container_start" ]
USER 1001:0