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

fixed running in docker #27

Merged
merged 1 commit into from
Jan 30, 2021
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
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
ARG PYTHON_VERSION="3.9.0"
ARG APP_NAME="githubsecrets"
ARG APP_ARTIFACT_DIR="artifact/"
ARG APP_PYTHON_USERBASE="/githubsecrets"
ARG APP_HOME_DIR="/app"
ARG APP_USER_NAME="appuser"
ARG APP_GROUP_ID="appgroup"
Expand Down Expand Up @@ -46,27 +47,30 @@ FROM python:$PYTHON_VERSION-slim as app
# Fetch values from ARGs that were declared at the top of this file
ARG APP_NAME
ARG APP_ARTIFACT_DIR
ARG APP_PYTHON_USERBASE
ARG APP_HOME_DIR
ARG APP_USER_NAME
ARG APP_GROUP_ID

RUN apt-get update && apt-get install -y libdbus-glib-1-dev gcc

# Define workdir
ENV HOME="${APP_HOME_DIR}"
WORKDIR "${HOME}"
ENV PYTHONUSERBASE="${APP_PYTHON_USERBASE}"
WORKDIR "${APP_PYTHON_USERBASE}"

# Define env vars
ENV APP_NAME="${APP_NAME}"
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV PIP_NO_CACHE_DIR=1
ENV PATH="${HOME}/.local/bin:${PATH}"

RUN apt-get update && apt-get install -y libdbus-glib-1-dev gcc
ENV PATH="${APP_PYTHON_USERBASE}/bin:${PATH}"

# Run as a non-root user
RUN addgroup "${APP_GROUP_ID}" && \
RUN mkdir "${APP_HOME_DIR}" && \
addgroup "${APP_GROUP_ID}" && \
useradd "${APP_USER_NAME}" --gid "${APP_GROUP_ID}" --home-dir "${HOME}" && \
mkdir "${APP_ARTIFACT_DIR}" && \
chown -R ${APP_USER_NAME} .
chown -R ${APP_USER_NAME} ${APP_PYTHON_USERBASE} ${HOME}
USER "${APP_USER_NAME}"

# Upgrade pip, setuptools and wheel
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Mount a local directory to `root`, the image is available at [DockerHub](https:/
Mount your home directory, or any other directory to save the credentials file

```bash
$ docker run --rm -it -v "${HOME}/:/root" unfor19/githubsecrets secret-list -p unfor19 -r githubsecrets
$ docker run --rm -it -v "${HOME}/:/app/" unfor19/githubsecrets secret-list -p unfor19 -r githubsecrets
... # Output below
```

Expand Down Expand Up @@ -102,7 +102,7 @@ $ docker run --rm -it -v "${HOME}/:/root" unfor19/githubsecrets secret-list -p u
Mount your Temp directory, or any other directory to save the credentials file. Make sure you use `/` and not `\`

```
$ docker run --rm -it -v c:/Temp:/root unfor19/githubsecrets secret-delete -p unfor19 -r githubsecrets -s testrepos
$ docker run --rm -it -v c:/Temp:/app/ unfor19/githubsecrets secret-delete -p unfor19 -r githubsecrets -s testrepos
... # Output below
```

Expand Down