Skip to content

Commit d22e2fc

Browse files
authored
chore!: update nodejs to 20 and ubuntu to 22.04 (#9)
1 parent 59a4e73 commit d22e2fc

File tree

4 files changed

+38
-389
lines changed

4 files changed

+38
-389
lines changed

.github/workflows/build_application_docker.yaml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
on:
22
workflow_dispatch:
3+
push:
4+
branches:
5+
- main
6+
schedule:
7+
- cron: '0 9 1,10,20,30 * *'
38

49
concurrency:
510
group: ${{ github.workflow }}
@@ -10,7 +15,9 @@ name: Build Application Docker
1015
env:
1116
REGISTRY: ghcr.io
1217
IMAGE_NAME: gravity-ui/node-nginx
13-
IMAGE_OS_NODE_VERSION: ubuntu20-nodejs18
18+
NODE_VERSION: '20'
19+
UBUNTU_VERSION: '22.04'
20+
IMAGE_UBUNTU_NODE_VERSION: ubuntu22-nodejs20
1421

1522
jobs:
1623
build:
@@ -42,10 +49,11 @@ jobs:
4249
with:
4350
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4451
tags: |
45-
type=raw,value=${{ env.IMAGE_OS_NODE_VERSION }}
46-
type=raw,value=${{ env.IMAGE_OS_NODE_VERSION }}.${{ env.BUILD_DATE }}
52+
type=raw,value=latest
53+
type=raw,value=${{ env.IMAGE_UBUNTU_NODE_VERSION }}
54+
type=raw,value=${{ env.IMAGE_UBUNTU_NODE_VERSION }}.${{ env.BUILD_DATE }}
4755
- name: Build and push Docker image
48-
uses: docker/build-push-action@v5.0.0
56+
uses: docker/build-push-action@v6.0.0
4957
with:
5058
context: .
5159
push: true
@@ -54,3 +62,6 @@ jobs:
5462
labels: ${{ steps.meta.outputs.labels }}
5563
cache-from: type=gha
5664
cache-to: type=gha,mode=max
65+
build-args: |
66+
UBUNTU_VERSION=${{ env.UBUNTU_VERSION }}
67+
NODE_VERSION=${{ env.NODE_VERSION }}

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
* @gorgeousvlad
2+
* @goshander

Dockerfile

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,37 @@
1-
FROM ubuntu:20.04
1+
ARG UBUNTU_VERSION=22.04
22

3-
# arg declartions
3+
FROM ubuntu:${UBUNTU_VERSION}
4+
5+
# arg declarations
6+
ARG NODE_MAJOR=20
47
ARG CERT
58

9+
ENV DEBIAN_FRONTEND=noninteractive
10+
611
# timezone setting
712
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
914

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
1416
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
1723

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
2030

2131
# adding certificate
2232
RUN echo $CERT > /usr/local/share/ca-certificates/cert.pem
2333
ENV NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/cert.pem
2434
RUN update-ca-certificates
2535

2636
# users setting
27-
RUN useradd -r app
37+
RUN useradd -r app && mkdir /opt/app && chown app:app /opt/app

0 commit comments

Comments
 (0)