Skip to content

Commit

Permalink
Merge pull request #27 from unfor19/feature-package-name
Browse files Browse the repository at this point in the history
fixed running in docker
  • Loading branch information
unfor19 authored Jan 30, 2021
2 parents 7e37511 + 7c0c0c6 commit 24e3807
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
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

0 comments on commit 24e3807

Please sign in to comment.