-
Notifications
You must be signed in to change notification settings - Fork 4
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
update docker to debian latest #40
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
# BUILD STAGE --------------------------------------- | ||
# split this stage to save time and reduce image size | ||
# --------------------------------------------------- | ||
FROM python:3.8-alpine3.11 as BuildStage | ||
# update apk cache | ||
RUN apk update | ||
FROM python:3.8-slim-bullseye as BuildStage | ||
# update apt | ||
RUN apt-get update | ||
# TODO: remove this when upgrading to a new alpine version | ||
# more details: https://github.com/pyca/cryptography/issues/5771 | ||
ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you explain why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
# install linux libraries necessary to compile some python packages | ||
RUN apk add --update --no-cache --virtual .build-deps gcc git build-base alpine-sdk python3-dev musl-dev postgresql-dev libffi-dev libressl-dev | ||
# TODO ask asaf about postgres 11 | ||
RUN apt-get install --fix-missing -y gcc git make python3-dev libpq-dev libffi-dev libssl-dev g++ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do this together with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wouldn't using the non-slim image will make the image larger? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you use the slim image and then all install deps yourself, you'll get the same size but longer setup times. Slim might actually be better, but I would test this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Couple of things:
|
||
# from now on, work in the /app directory | ||
WORKDIR /app/ | ||
# Layer dependency install (for caching) | ||
|
@@ -19,11 +20,18 @@ RUN pip install --upgrade pip && pip install --user -r requirements.txt | |
# MAIN IMAGE ---------------------------------------- | ||
# most of the time only this image should be built | ||
# --------------------------------------------------- | ||
FROM python:3.8-alpine3.11 | ||
FROM python:3.8-slim-bullseye | ||
# setup optional testing repo for newer packages | ||
COPY docker-files/testing.list /etc/apt/sources.list.d/ | ||
COPY docker-files/testing.prefs /etc/apt/preferences.d/ | ||
# update apt | ||
RUN apt-get update | ||
# bash is needed for ./start/sh script | ||
RUN apk add --update --no-cache bash curl | ||
RUN apt-get -y install curl | ||
# needed for rookout | ||
RUN apk add g++ python3-dev linux-headers | ||
RUN apt-get -y install --fix-missing gcc g++ python3-dev | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On my tests seems like rookout is installable & importable without that line. (wasn't the case on alpine) |
||
# install newer pcre2 to resolve CVE-2022-1586 | ||
RUN apt-get -y install -t testing libpcre2-8-0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Merge all |
||
# copy opa from official image (main binary and lib for web assembly) | ||
RUN curl -L -o /opa https://openpolicyagent.org/downloads/latest/opa_linux_amd64_static && chmod 755 /opa | ||
# copy libraries from build stage | ||
|
@@ -72,4 +80,4 @@ EXPOSE 7000 | |
# expose opa directly | ||
EXPOSE 8181 | ||
# run gunicorn | ||
CMD ["/start.sh"] | ||
CMD ["/start.sh"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (can't comment on lines that haven't change) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for that :) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
deb http://deb.debian.org/debian bookworm main | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this needed? Might cause collisions between versions (not unlike what we have with tenacity). If debian bullseye has versions too old for what you need, consider using Ubuntu. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a very new version, with a patch for critical vlun |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# 100 <= P < 500: causes a version to be installed unless there is a | ||
# version available belonging to some other distribution or the installed | ||
# version is more recent | ||
|
||
Package: * | ||
Pin: release a=testing | ||
Pin-Priority: 400 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import requests | ||
from typing import Optional | ||
|
||
from tenacity import retry, wait, stop, retry_if_not_exception_type | ||
# TODO: readd after we release the new version of opal (should be next week) | ||
#from tenacity import retry, wait, stop, retry_if_not_exception_type | ||
from tenacity import retry, wait, stop | ||
from pydantic import ValidationError | ||
from opal_common.logger import logger | ||
|
||
|
@@ -50,7 +52,8 @@ class RemoteConfigFetcher: | |
organizations (which is not secure). | ||
""" | ||
DEFAULT_RETRY_CONFIG = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @orishavit please review it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
'retry': retry_if_not_exception_type(InvalidPDPTokenException), | ||
# TODO: readd after we release the new version of opal (should be next week) | ||
# 'retry': retry_if_not_exception_type(InvalidPDPTokenException), | ||
'wait': wait.wait_random_exponential(max=10), | ||
'stop': stop.stop_after_attempt(10), | ||
'reraise': True, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for slim in the BuildStage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not Python 3.10 ?
(I mean you probably want it fast for Riskified, but would be good to upgrade in the near future)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should test our code for 3.10, I would be glad to know that we can move to 3.10 @asafc, can we?