1
1
# To run: docker run -d --name=dataportal -p 80:80 quay.io/cdis/data-portal
2
2
# To check running container: docker exec -it dataportal /bin/bash
3
3
4
- FROM quay.io/cdis/ubuntu:20.04
4
+ FROM quay.io/cdis/nodejs-base:master
5
5
6
- ENV DEBIAN_FRONTEND=noninteractive
7
6
ENV REACT_APP_PROJECT_ID=search
8
7
9
- # disable npm 7's brand new update notifier to prevent Portal from stuck at starting up
10
- # see https://github.com/npm/cli/issues/3163
11
- ENV NPM_CONFIG_UPDATE_NOTIFIER=false
12
-
13
- RUN apt-get update && apt-get install -y --no-install-recommends \
14
- build-essential \
15
- libssl1.1 \
16
- libgnutls30 \
17
- ca-certificates \
18
- curl \
19
- git \
20
- nginx \
21
- python3 \
22
- time \
23
- vim \
24
- && curl -sL https://deb.nodesource.com/setup_16.x | bash - \
25
- && apt-get install -y --no-install-recommends nodejs \
26
- && apt-get clean \
27
- && rm -rf /var/lib/apt/lists/* \
28
- && ln -sf /dev/stdout /var/log/nginx/access.log \
29
- && ln -sf /dev/stderr /var/log/nginx/error.log \
30
- && npm install -g npm@8.5
8
+ # Install nginx
9
+ RUN yum install nginx -y && \
10
+ # allows nginx to run on port 80 without being root user
11
+ setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx && \
12
+ chown -R gen3:gen3 /var/log/nginx && \
13
+ # pipe nginx logs to stdout/stderr
14
+ ln -sf /dev/stdout /var/log/nginx/access.log && \
15
+ ln -sf /dev/stderr /var/log/nginx/error.log && \
16
+ mkdir -p /var/lib/nginx/tmp/client_body && \
17
+ chown -R gen3:gen3 /var/lib/nginx/ && \
18
+ mkdir -p /var/cache/nginx && \
19
+ chown -R gen3:gen3 /var/cache/nginx \
20
+ && touch /var/run/nginx.pid \
21
+ && chown -R gen3:gen3 /var/run/nginx.pid
31
22
32
23
ARG APP=dev
33
24
ARG BASENAME
34
25
35
26
RUN mkdir -p /data-portal
36
27
COPY . /data-portal
28
+ RUN cp /data-portal/nginx.conf /etc/nginx/conf.d/nginx.conf \
29
+ && chown -R gen3:gen3 /etc/nginx/conf.d \
30
+ && chown -R gen3:gen3 /data-portal
31
+
32
+ # In standard prod these will be overwritten by volume mounts
33
+ # Provided here for ease of use in development and
34
+ # non-standard deployment environments
35
+
36
+ RUN mkdir /mnt/ssl \
37
+ && openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /mnt/ssl/nginx.key -out /mnt/ssl/nginx.crt -subj '/countryName=US/stateOrProvinceName=Illinois/localityName=Chicago/organizationName=CDIS/organizationalUnitName=PlanX/commonName=localhost/emailAddress=ops@cdis.org' \
38
+ && chmod 755 /mnt/ssl/nginx.crt \
39
+ && chmod 755 /mnt/ssl/nginx.key
40
+
37
41
WORKDIR /data-portal
42
+ USER gen3
38
43
RUN COMMIT=`git rev-parse HEAD` && echo "export const portalCommit = \" ${COMMIT}\" ;" >src/versions.js \
39
44
&& VERSION=`git describe --always --tags` && echo "export const portalVersion =\" ${VERSION}\" ;" >>src/versions.js \
40
45
&& /bin/rm -rf .git \
@@ -44,15 +49,6 @@ RUN npm config set unsafe-perm=true \
44
49
&& npm run relay \
45
50
&& npm run params
46
51
# see https://stackoverflow.com/questions/48387040/nodejs-recommended-max-old-space-size
47
- RUN NODE_OPTIONS=--max-old-space-size=3584 NODE_ENV=production time npx webpack build
48
- RUN cp nginx.conf /etc/nginx/conf.d/nginx.conf \
49
- && rm /etc/nginx/sites-enabled/default
50
-
51
- # In standard prod these will be overwritten by volume mounts
52
- # Provided here for ease of use in development and
53
- # non-standard deployment environments
54
-
55
- RUN mkdir /mnt/ssl \
56
- && openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /mnt/ssl/nginx.key -out /mnt/ssl/nginx.crt -subj '/countryName=US/stateOrProvinceName=Illinois/localityName=Chicago/organizationName=CDIS/organizationalUnitName=PlanX/commonName=localhost/emailAddress=ops@cdis.org'
52
+ RUN NODE_OPTIONS=--max-old-space-size=3584 NODE_ENV=production npx webpack build
57
53
58
54
CMD [ "bash" , "./dockerStart.sh" ]
0 commit comments