Skip to content

Commit eee79ce

Browse files
author
Artem
committed
add docker build scripts to ci and remove redisstack unnecessary artifacts
1 parent c385cef commit eee79ce

File tree

6 files changed

+157
-74
lines changed

6 files changed

+157
-74
lines changed

.circleci/build/build.Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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"]
39+
#ENTRYPOINT ["tail", "-f", "/dev/null"]
File renamed without changes.

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,18 @@
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+
echo $FILENAME
917

1018
# reinstall backend prod dependencies only (optimise space)
1119
rm -rf redisinsight/api/node_modules
@@ -23,13 +31,13 @@ rm -rf redisinsight/build.zip
2331

2432
cp LICENSE ./redisinsight
2533

26-
cd redisinsight && tar -czvf build.tar.gz \
34+
cd redisinsight && tar -czf build.tar.gz \
2735
--exclude="api/node_modules/**/build/node_gyp_bins/python3" \
2836
api/node_modules \
2937
api/dist \
3038
ui/dist \
3139
LICENSE \
3240
&& cd ..
3341

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

.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)