Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue 957: run as non-root user in docker #959

Merged
merged 1 commit into from
Mar 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@ FROM maven:latest

COPY . /usr/src/app
WORKDIR /usr/src/app

RUN useradd -m -u 1000 builder
RUN chown -R builder /usr/src/app
USER builder

RUN mvn clean compile

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
IMAGE_NAME := openstack4j-dev$(if $(GIT_BRANCH),:$(GIT_BRANCH))
DOCKER_RUN := docker run --rm -it --privileged $(IMAGE_NAME)
DOCKER_RUN := docker run --rm -it --privileged -e MAVEN_CONFIG=/home/builder/.m2 $(IMAGE_NAME)

default: build

Expand All @@ -21,4 +21,4 @@ package: build
$(DOCKER_RUN) mvn clean package

build:
docker build -t "$(IMAGE_NAME)" .
docker build -t "$(IMAGE_NAME)" .