Skip to content

Commit 5e3e49c

Browse files
committed
adding new non-root gpuser user
1 parent 2baf2e5 commit 5e3e49c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,26 @@ MAINTAINER Barbara Hill <bhill@broadinstitute.org>
66
# While you are debugging/iterating over your module code in the Module integrator comment out the secion below.
77
# When you are done, export your module, unzip and move your source files into the src directory in this local workspace.
88
# Then, update this section for you module and build using the docker build command below - again updated for your module.
9+
# Note that you only need to add gpuser if you base image (the image specified in FROM) is run as root. If it runs as another user, you may need to become root (USER root) to add folders...etc. Just make sure to switch back to the non-root user before exiting.
910
# -----------------------------------
11+
#creating a non-root user - see above
12+
RUN useradd -ms /bin/bash gpuser
13+
USER newuser
14+
WORKDIR /home/newuser
15+
16+
#switch back to root to create dir
17+
USER root
1018
RUN mkdir /ExampleModule \
1119
&& chown gpuser /ExampleModule
1220

21+
#switch to non-root before exiting so that we don't run as root on the server.
1322
USER gpuser
1423
COPY src/*.py /ExampleModule/
1524

1625
RUN /ExampleModule/ExampleModule.py
1726
# -----------------------------------
1827

19-
# docker build --rm https://github.com/genepattern/ExampleModule#develop -f Dockerfile -t genepattern/example-module:2
28+
# docker build --rm https://github.com/genepattern/ExampleModule.git#develop -f Dockerfile -t genepattern/example-module:2
2029
# make sure this repo and tag match the manifest & don't forget to docker push!
2130

2231
# you can use this command to run Docker and iterate locally (update for your paths and module name, of course)

0 commit comments

Comments
 (0)