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

update docker to debian latest #40

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

obsd
Copy link
Contributor

@obsd obsd commented Jun 22, 2022

No description provided.

@obsd obsd requested a review from shaulk June 22, 2022 12:42
@shaulk shaulk force-pushed the bugfix/oded/fix-docker branch from 0ba9194 to 9bc875e Compare June 22, 2022 14:37
@@ -50,7 +52,8 @@ class RemoteConfigFetcher:
organizations (which is not secure).
"""
DEFAULT_RETRY_CONFIG = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orishavit please review it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@obsd obsd requested a review from orishavit June 22, 2022 19:34
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain why?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRYPTOGRAPHY_DONT_BUILD_RUST looks like an alpine thing

FROM python:3.8-alpine3.11 as BuildStage
# update apk cache
RUN apk update
FROM python:3.8-slim-bullseye as BuildStage
Copy link
Contributor

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

Copy link
Contributor

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)

Copy link
Contributor Author

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?

# 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
# 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++
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do this together with apt-get update

Copy link
Contributor

@roekatz roekatz Jun 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • & apt-get clean to reduce image size.
  • Also - if you take @orishavit 's advice and use python3.8 without the slim, it almost certainly already has you covered in terms of deps and no real need to install anything else (that's the purpose of that image, and that was my experience with opal) - That would speed up the image build which is always good

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't using the non-slim image will make the image larger?

Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of things:

  • Actually Python's official rule of thumb is go with the regular. It's bigger in size but many images are using the underlying buildpack-deps - therefor it "compresses" better per machine (docker stores the layer only once for many images).
  • The BuildStage is a temporary thing just used to build the pkgs, the final image can be still based on the slim flavor.

RUN apk add g++ python3-dev linux-headers
RUN apt-get -y install --fix-missing gcc g++ python3-dev
# install newer pcre2 to resolve CVE-2022-1586
RUN apt-get -y install -t testing libpcre2-8-0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge all apt-gets to one step

@@ -50,7 +52,8 @@ class RemoteConfigFetcher:
organizations (which is not secure).
"""
DEFAULT_RETRY_CONFIG = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -0,0 +1 @@
deb http://deb.debian.org/debian bookworm main
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very new version, with a patch for critical vlun
https://security.snyk.io/vuln/SNYK-DEBIAN11-PCRE2-2808697
Check out the date

@obsd obsd force-pushed the bugfix/oded/fix-docker branch from f5afd19 to 3cdd0bd Compare June 23, 2022 12:12
CMD ["/start.sh"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(can't comment on lines that haven't change)
regarding wait-for-it.sh... I found that it uses nc which isn't installed by default. (apt-get install netcat).
I think u don't use it here anyway...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for that :)

# needed for rookout
RUN apk add g++ python3-dev linux-headers
RUN apt-get -y install --fix-missing gcc g++ python3-dev
Copy link
Contributor

Choose a reason for hiding this comment

The 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants