|
1 | | -FROM ubuntu:20.04 |
| 1 | +ARG UBUNTU_VERSION=22.04 |
2 | 2 |
|
3 | | -# arg declartions |
| 3 | +FROM ubuntu:${UBUNTU_VERSION} |
| 4 | + |
| 5 | +# arg declarations |
| 6 | +ARG NODE_MAJOR=20 |
4 | 7 | ARG CERT |
5 | 8 |
|
| 9 | +ENV DEBIAN_FRONTEND=noninteractive |
| 10 | + |
6 | 11 | # timezone setting |
7 | 12 | ENV TZ="Etc/UTC" |
8 | | -RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime |
| 13 | +RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone |
9 | 14 |
|
10 | | -# deps installation |
11 | | -COPY ./scripts/ /tmp/scripts/ |
12 | | -RUN chmod +x /tmp/scripts/setup_18.x |
13 | | -RUN /tmp/scripts/setup_18.x |
| 15 | +# deps and nodejs installation |
14 | 16 | RUN apt-get update && \ |
15 | | - DEBIAN_FRONTEND=noninteractive apt-get -y install tzdata && \ |
16 | | - apt-get -y install nano vim nginx curl git telnet bzip2 iproute2 wget supervisor nodejs |
| 17 | + apt-get -y upgrade && \ |
| 18 | + apt-get -y install ca-certificates curl gnupg tzdata nano vim nginx curl git telnet bzip2 iproute2 wget supervisor && \ |
| 19 | + mkdir -p /etc/apt/keyrings && \ |
| 20 | + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \ |
| 21 | + echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \ |
| 22 | + apt-get update && apt-get -y install nodejs |
17 | 23 |
|
18 | | -# cleanup tmp and defaults |
19 | | -RUN rm -rf /etc/nginx/sites-enabled/default /var/lib/apt/lists/* /tmp/scripts |
| 24 | +# remove unnecessary packages and defaults config |
| 25 | +RUN apt-get -y purge curl gnupg gnupg2 && \ |
| 26 | + apt-get -y autoremove && \ |
| 27 | + apt-get clean && \ |
| 28 | + rm -rf /var/lib/apt/lists/* && \ |
| 29 | + rm -rf /etc/nginx/sites-enabled/default |
20 | 30 |
|
21 | 31 | # adding certificate |
22 | 32 | RUN echo $CERT > /usr/local/share/ca-certificates/cert.pem |
23 | 33 | ENV NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/cert.pem |
24 | 34 | RUN update-ca-certificates |
25 | 35 |
|
26 | 36 | # users setting |
27 | | -RUN useradd -r app |
| 37 | +RUN useradd -r app && mkdir /opt/app && chown app:app /opt/app |
0 commit comments