Skip to content

Commit

Permalink
chore(docker): update dockerfile to 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Jguer committed Jul 5, 2021
1 parent 4852859 commit 078e60f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 29 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*
**
.*

!Pipfile*
!ggshield
!README.md
Expand Down
36 changes: 8 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,56 +1,36 @@
FROM python:3.8-buster as build
FROM python:3.9-slim as build

LABEL maintainer="GitGuardian SRE Team <support@gitguardian.com>"

ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8
ENV PIPENV_VENV_IN_PROJECT true
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1
ENV PATH /app/.venv/bin:$PATH

WORKDIR /app

# Install your required build dependencies here
RUN set -e ; \
apt-get update ; \
apt-get dist-upgrade -y --no-install-recommends ; \
apt-get autoremove -y ; \
apt-get clean ; \
pip3 install pipenv --upgrade ; \
rm -rf /var/lib/apt/lists/*


# COPY Pipfile Pipfile.lock ./
# OR (choose depending on whether you need the ./setup.py to get executed or not)
COPY . ./
RUN sed -i '/editable/d' Pipfile.lock
RUN pipenv install --ignore-pipfile


FROM python:3.8-slim-buster

LABEL maintainer="GitGuardian SRE Team <support@gitguardian.com>"

RUN set -e ; \
apt-get update ; \
apt-get dist-upgrade -y --no-install-recommends ; \
apt-get install -y --no-install-recommends git ssh ; \
apt-get autoremove -y ; \
apt-get clean ; \
pip3 install pipenv --upgrade ; \
rm -rf /var/lib/apt/lists/*

COPY . .

ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8
ENV PATH /app/.venv/bin:$PATH

WORKDIR /app
RUN pipenv install --ignore-pipfile --deploy

RUN set -ex; \
groupadd -g 1337 app; \
useradd -u 1337 -g 1337 -b /home -c "GitGuardian App User" -m -s /bin/sh app; \
mkdir /data; chmod 777 /data

COPY --from=build /app/.venv /app/.venv
COPY ./ ./
USER app

WORKDIR /data
VOLUME [ "/data" ]
Expand Down

0 comments on commit 078e60f

Please sign in to comment.