Skip to content

Commit c1fb864

Browse files
committed
Fix bare except in load_module and add non-root user to Dockerfile
1 parent 965e17d commit c1fb864

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

release/docker/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,9 @@ RUN export PIP_BREAK_SYSTEM_PACKAGES=1 PIP_ROOT_USER_ACTION=ignore && \
8686
# Clean up before finishing.
8787
RUN apt-get clean
8888

89+
# Create a non-root user and switch to it.
90+
RUN useradd -m -s /bin/bash tfq-user
91+
USER tfq-user
92+
WORKDIR /home/tfq-user
93+
8994
CMD ["/bin/bash"]

tensorflow_quantum/core/ops/load_module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def _load(self):
4747
try:
4848
path = resource_loader.get_path_to_datafile(self._name)
4949
self._module = load_library.load_op_library(path)
50-
except:
50+
except Exception: # pylint: disable=broad-except
5151
path = os.path.join(get_python_lib(),
5252
"tensorflow_quantum/core/ops", self._name)
5353
self._module = load_library.load_op_library(path)

0 commit comments

Comments
 (0)