Skip to content

Commit

Permalink
resolved redis vulnerabilities, updated flask to attempt pip fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dbsmith88 committed Apr 25, 2024
1 parent 8248617 commit d08dd5c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ RUN rm -R /opt/conda/pkgs/redis*
#RUN rm -R /opt/conda/bin/redis*
RUN rm -R /opt/conda/pkgs/postgres*
#RUN rm -R /opt/conda/bin/postgres*
RUN rm -R /opt/conda/envs/pyenv/lib/python3.10/site-packages/pip
RUN rm -R /opt/conda/envs/pyenv/lib/python3.10/site-packages/pip-24.0-py3.12.egg-info
RUN find /opt/conda/pkgs/future* -name "*.pem" -delete || true
RUN find /opt/conda/lib/python3.10/site-packages/future -name "*.pem" -delete || true
RUN find /opt/conda/envs/pyenv -name "*.pem" -delete || true
Expand Down
11 changes: 5 additions & 6 deletions Dockerfile_Redis
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ FROM redis:7.2.4-alpine

RUN apk add --upgrade apk-tools
RUN apk upgrade --available

#------ vulnerability fixes ------#
RUN apk del go
COPY --from=tianon/gosu /gosu /usr/local/bin/
RUN find /usr/lib -name *.pem -delete
#---------------------------------#
COPY redis-docker-entrypoint.sh /usr/local/bin/
RUN mv /usr/local/bin/redis-docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
RUN apk add --no-cache su-exec
RUN rm /usr/local/bin/gosu
24 changes: 24 additions & 0 deletions redis-docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
set -e

# first arg is `-f` or `--some-option`
# or first arg is `something.conf`
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
set -- redis-server "$@"
fi

# allow the container to be started with `--user`
if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then
find . \! -user redis -exec chown redis '{}' +
exec su-exec redis "$0" "$@"
fi

# set an appropriate umask (if one isn't set already)
# - https://github.com/docker-library/redis/issues/305
# - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37
um="$(umask)"
if [ "$um" = '0022' ]; then
umask 0077
fi

exec "$@"

0 comments on commit d08dd5c

Please sign in to comment.