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

Docker image user permissions fix (#1373) #1378

Merged
merged 3 commits into from
Jun 25, 2020
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
18 changes: 9 additions & 9 deletions core/src/epicli/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
FROM python:3.7-slim

ARG EPICLI_VERSION

ARG USERNAME=epiuser
ARG USER_UID=1000
ARG USER_GID=$USER_UID

ENV DOCKER_CLI Yes
ENV EPICLI_DOCKER_SHARED_DIR=/shared

COPY /dist/ /epicli
WORKDIR /epicli

RUN apt-get update \
&& apt-get -y install gcc make musl-dev libffi-dev tar unzip openssh-client vim \
&& apt-get -y install ruby-full \
&& gem install serverspec rake rspec_junit_formatter
&& gem install serverspec rake rspec_junit_formatter

RUN pip install epicli-${EPICLI_VERSION}-py3-none-any.whl

RUN groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& apt-get install -y sudo \

&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \

&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/*

RUN mkdir $EPICLI_DOCKER_SHARED_DIR \
;chown :$USERNAME $EPICLI_DOCKER_SHARED_DIR \
&& chmod g+w $EPICLI_DOCKER_SHARED_DIR

RUN mkdir /shared/
WORKDIR /shared
WORKDIR $EPICLI_DOCKER_SHARED_DIR

USER $USERNAME

Expand Down
4 changes: 2 additions & 2 deletions core/src/epicli/cli/helpers/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
class Config:
class __ConfigBase:
def __init__(self):
self._docker_cli = bool(os.environ.get('DOCKER_CLI', ''))
self._docker_cli = bool(os.environ.get('EPICLI_DOCKER_SHARED_DIR',''))

self._output_dir = None
if self._docker_cli:
self._output_dir = '/shared/build/'
self._output_dir = os.path.join(os.environ.get('EPICLI_DOCKER_SHARED_DIR'), 'build')

self._log_file = 'log.log'
self._log_format = '%(asctime)s %(levelname)s %(name)s - %(message)s'
Expand Down