Skip to content

Commit 40016a8

Browse files
author
Artem
authored
Merge pull request #2958 from RedisInsight/feature/RI-5045-build-docker
add docker build scripts to ci and remove redisstack unnecessary arti…
2 parents 02916a8 + e54f392 commit 40016a8

File tree

7 files changed

+174
-75
lines changed

7 files changed

+174
-75
lines changed

.circleci/build/build.Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM node:18.18-alpine
2+
3+
# runtime args and environment variables
4+
ARG DIST=RedisInsight.tar.gz
5+
ARG NODE_ENV=production
6+
ARG RI_SEGMENT_WRITE_KEY
7+
ENV RI_SEGMENT_WRITE_KEY=${RI_SEGMENT_WRITE_KEY}
8+
ENV NODE_ENV=${NODE_ENV}
9+
ENV RI_SERVE_STATICS=true
10+
ENV RI_BUILD_TYPE='DOCKER_ON_PREMISE'
11+
ENV RI_APP_FOLDER_ABSOLUTE_PATH='/data'
12+
13+
# this resolves CVE-2023-5363
14+
# TODO: remove this line once we update to base image that doesn't have this vulnerability
15+
RUN apk update && apk upgrade --no-cache libcrypto3 libssl3
16+
17+
# set workdir
18+
WORKDIR /usr/src/app
19+
20+
# copy artifacts built in previous stage to this one
21+
ADD $DIST /usr/src/app/redisinsight
22+
RUN ls -la /usr/src/app/redisinsight
23+
24+
# folder to store local database, plugins, logs and all other files
25+
RUN mkdir -p /data && chown -R node:node /data
26+
27+
# copy the docker entry point script and make it executable
28+
COPY --chown=node:node ./docker-entry.sh ./
29+
RUN chmod +x docker-entry.sh
30+
31+
# since RI is hard-code to port 5000, expose it from the container
32+
EXPOSE 5000
33+
34+
# don't run the node process as root
35+
USER node
36+
37+
# serve the application 🚀
38+
ENTRYPOINT ["./docker-entry.sh", "node", "redisinsight/api/dist/src/main"]
File renamed without changes.

.circleci/redisstack/build_modules.sh renamed to .circleci/build/build_modules.sh

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,25 @@
22
set -e
33

44
PLATFORM=${PLATFORM:-'linux'}
5-
ELECTRON_VERSION=$(cat electron/version)
65
ARCH=${ARCH:-'x64'}
6+
LIBC=${LIBC:-''}
77
#FILENAME="RedisInsight-$PLATFORM.$VERSION.$ARCH.zip"
8-
FILENAME="RedisInsight-web-$PLATFORM.$ARCH.tar.gz"
8+
FILENAME="RedisInsight-web-$PLATFORM"
9+
if [ ! -z $LIBC ]
10+
then
11+
FILENAME="$FILENAME-$LIBC.$ARCH.tar.gz"
12+
export npm_config_target_libc="$LIBC"
13+
else
14+
FILENAME="$FILENAME.$ARCH.tar.gz"
15+
fi
16+
17+
echo "Building node modules..."
18+
echo "Platform: $PLATFORM"
19+
echo "Arch: $ARCH"
20+
echo "Libc: $LIBC"
21+
echo "npm target libc: $npm_config_target_libc"
22+
echo "Filname: $FILENAME"
923

10-
# reinstall backend prod dependencies only (optimise space)
1124
rm -rf redisinsight/api/node_modules
1225

1326
npm_config_arch="$ARCH" \
@@ -23,13 +36,13 @@ rm -rf redisinsight/build.zip
2336

2437
cp LICENSE ./redisinsight
2538

26-
cd redisinsight && tar -czvf build.tar.gz \
39+
cd redisinsight && tar -czf build.tar.gz \
2740
--exclude="api/node_modules/**/build/node_gyp_bins/python3" \
2841
api/node_modules \
2942
api/dist \
3043
ui/dist \
3144
LICENSE \
3245
&& cd ..
3346

34-
mkdir -p release/redisstack
35-
cp redisinsight/build.tar.gz release/redisstack/"$FILENAME"
47+
mkdir -p release/web
48+
cp redisinsight/build.tar.gz release/web/"$FILENAME"

.circleci/build/manual-build-validate.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ const whitelist = {
1717
'windows': {
1818
'nsis': 1,
1919
'nsis:x64': 1,
20+
},
21+
'docker': {
22+
'all': 1,
2023
}
2124
};
2225

.circleci/redisstack/sum_sha256.sh renamed to .circleci/build/sum_sha256.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -e
33

4-
cd ./release/redisstack
4+
cd ./release/web
55

66
for f in *.tar.gz; do
77
sha256sum "$f" > "$f.sha256"

0 commit comments

Comments
 (0)