1
1
ARG AZLINUX_BASE_VERSION=master
2
2
3
- # Base stage with python-build-base
4
- FROM quay.io/cdis/python-build-base:${AZLINUX_BASE_VERSION} AS base
3
+ FROM quay.io/cdis/python-nginx-al:${AZLINUX_BASE_VERSION} AS base
5
4
6
- # Comment this in, and comment out the line above, if quay is down
7
- # FROM 707767160287.dkr.ecr.us-east-1.amazonaws.com/gen3/python-build-base:${AZLINUX_BASE_VERSION} as base
5
+ # FROM 707767160287.dkr.ecr.us-east-1.amazonaws.com/gen3/python-nginx-al2:feat_python-nginx AS base
8
6
9
7
ENV appname=peregrine
10
- ENV POETRY_NO_INTERACTION=1 \
11
- POETRY_VIRTUALENVS_IN_PROJECT=1 \
12
- POETRY_VIRTUALENVS_CREATE=1
13
8
14
9
WORKDIR /${appname}
15
10
16
- # create gen3 user
17
- # Create a group 'gen3' with GID 1000 and a user 'gen3' with UID 1000
18
- RUN groupadd -g 1000 gen3 && \
19
- useradd -m -s /bin/bash -u 1000 -g gen3 gen3 && \
20
- chown -R gen3:gen3 /$appname && \
21
- chown -R gen3:gen3 /venv
22
-
23
- RUN dnf update && dnf install -y \
24
- python3-devel \
25
- postgresql15-server-devel \
26
- && rm -rf /var/cache/yum
11
+ RUN chown -R gen3:gen3 /$appname
27
12
28
13
# Builder stage
29
14
FROM base AS builder
30
15
31
16
USER gen3
32
17
33
- RUN python -m venv /venv
34
-
35
18
COPY poetry.lock pyproject.toml /${appname}/
36
19
37
- RUN pip install poetry && \
38
- poetry install -vv --only main --no-interaction
20
+ RUN poetry install -vv --only main --no-interaction
39
21
40
22
COPY --chown=gen3:gen3 . /$appname
41
23
COPY --chown=gen3:gen3 ./deployment/wsgi/wsgi.py /$appname/wsgi.py
@@ -49,36 +31,11 @@ RUN git config --global --add safe.directory /${appname} && COMMIT=`git rev-pars
49
31
# Final stage
50
32
FROM base
51
33
52
- COPY --from=builder /venv /venv
53
34
COPY --from=builder /$appname /$appname
54
35
55
- # install nginx
56
- RUN yum install nginx -y
57
-
58
- # allow nginx to bind to port 80
59
- RUN setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx
60
-
61
- # chown nginx directories
62
- RUN chown -R gen3:gen3 /var/log/nginx
63
-
64
- # pipe nginx logs to stdout and stderr
65
- RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
66
-
67
- # create /var/lib/nginx/tmp/client_body to allow nginx to write to fence
68
- RUN mkdir -p /var/lib/nginx/tmp/client_body
69
- RUN chown -R gen3:gen3 /var/lib/nginx/
70
-
71
- # copy nginx config
72
- COPY ./deployment/nginx/nginx.conf /etc/nginx/nginx.conf
73
-
74
36
# Switch to non-root user 'gen3' for the serving process
75
37
USER gen3
76
38
77
- RUN source /venv/bin/activate
78
-
79
- ENV PYTHONUNBUFFERED=1 \
80
- PYTHONIOENCODING=UTF-8
81
-
82
- WORKDIR /var/www/${appname}
39
+ WORKDIR /$appname
83
40
84
- CMD ["/bin/bash" , "-c" , "/peregrine /dockerrun.bash" ]
41
+ CMD ["/bin/bash" , "-c" , "/${appname} /dockerrun.bash" ]
0 commit comments