Skip to content

Commit

Permalink
cleaning up manifestservice and using python nginx base image
Browse files Browse the repository at this point in the history
  • Loading branch information
EliseCastle23 committed Nov 1, 2024
1 parent dfa24d1 commit 0e0d8e6
Show file tree
Hide file tree
Showing 4 changed files with 215 additions and 304 deletions.
49 changes: 2 additions & 47 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,23 @@
ARG AZLINUX_BASE_VERSION=master

# Base stage with python-build-base
FROM quay.io/cdis/python-build-base:${AZLINUX_BASE_VERSION} AS base
FROM quay.io/cdis/python-nginx-al:feat_python-nginx AS base

# Comment this in, and comment out the line above, if quay is down
# FROM 707767160287.dkr.ecr.us-east-1.amazonaws.com/gen3/python-build-base:${AZLINUX_BASE_VERSION} as base

ENV appname=manifestservice
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1

WORKDIR /${appname}

# create gen3 user
# Create a group 'gen3' with GID 1000 and a user 'gen3' with UID 1000
RUN groupadd -g 1000 gen3 && \
useradd -m -s /bin/bash -u 1000 -g gen3 gen3 && \
chown -R gen3:gen3 /$appname && \
chown -R gen3:gen3 /venv


# Builder stage
FROM base AS builder

USER gen3


RUN python -m venv /venv

COPY poetry.lock pyproject.toml /${appname}/

RUN pip install poetry && \
poetry install -vv --only main --no-interaction
RUN poetry install -vv --only main --no-interaction

COPY --chown=gen3:gen3 . /$appname
COPY --chown=gen3:gen3 ./deployment/wsgi/wsgi.py /$appname/wsgi.py
Expand All @@ -46,39 +31,9 @@ RUN git config --global --add safe.directory /${appname} && COMMIT=`git rev-pars
# Final stage
FROM base

COPY --from=builder /venv /venv
COPY --from=builder /$appname /$appname


# Install nginx
RUN yum install nginx -y

RUN setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx

# chown nginx directories
RUN chown -R gen3:gen3 /var/log/nginx

# pipe nginx logs to stdout and stderr
RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log

# create /var/lib/nginx/tmp/client_body to allow nginx to write to indexd
RUN mkdir -p /var/lib/nginx/tmp/client_body
RUN chown -R gen3:gen3 /var/lib/nginx/

# copy nginx config
COPY ./deployment/nginx/nginx.conf /etc/nginx/nginx.conf

# Switch to non-root user 'gen3' for the serving process
USER gen3

RUN source /venv/bin/activate

ENV PYTHONUNBUFFERED=1 \
PYTHONIOENCODING=UTF-8

CMD ["/bin/bash", "-c", "/manifestservice/dockerrun.bash"]
# RUN apt-get update \
# && apt-get install -y --no-install-recommends\
# libmcrypt4 libmhash2 mcrypt \
# curl bash git vim \
# && apt-get clean
44 changes: 0 additions & 44 deletions deployment/nginx/nginx.conf

This file was deleted.

Loading

0 comments on commit 0e0d8e6

Please sign in to comment.