From 69661f19861d87f8546e1d42fad7149c24573f0c Mon Sep 17 00:00:00 2001 From: Ildar Iskhakov Date: Tue, 29 Aug 2023 15:03:32 +0800 Subject: [PATCH] Switch to alpine base image (#2872) # What this PR does ## Which issue(s) this PR fixes ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [ ] Documentation added (or `pr:no public docs` PR label added if not required) - [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) --- CHANGELOG.md | 4 ++++ engine/Dockerfile | 29 ++++++++++++++--------------- engine/requirements.txt | 2 +- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d28cedbb..5395ca41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Changed + +- Switch engine to alpine base image ([2872](https://github.com/grafana/oncall/pull/2872)) + ### Fixed - Address bug when a Shift Swap Request is accepted either via the web or mobile UI, and the Slack message is not diff --git a/engine/Dockerfile b/engine/Dockerfile index 9ba6b4e0..73f76a8b 100644 --- a/engine/Dockerfile +++ b/engine/Dockerfile @@ -1,25 +1,24 @@ -FROM python:3.11.4-slim-bookworm AS base +FROM python:3.11.4-alpine3.18 AS base # Create a group and user to run an app ENV APP_USER=appuser -RUN groupadd --system --gid 2000 ${APP_USER} && \ - useradd --no-log-init --system --uid 1000 --gid ${APP_USER} ${APP_USER} +RUN addgroup --system --gid 2000 ${APP_USER} && \ + adduser --system --uid 1000 --ingroup ${APP_USER} ${APP_USER} -RUN apt-get update && apt-get install -y \ - python3-dev \ - gcc \ - libmariadb-dev \ - libpq-dev \ - netcat-traditional \ - curl \ - bash \ - git \ - libpcre3 \ - libpcre3-dev +RUN apk add bash \ + python3-dev \ + build-base \ + linux-headers \ + pcre-dev \ + mariadb-connector-c-dev \ + libffi-dev \ + git \ + postgresql-dev WORKDIR /etc/app COPY ./requirements.txt ./ RUN pip install --upgrade pip +RUN pip install --upgrade setuptools wheel RUN pip install -r requirements.txt # we intentionally have two COPY commands, this is to have the requirements.txt in a separate build step @@ -48,7 +47,7 @@ RUN chown -R ${APP_USER}:${APP_USER} /tmp/prometheus_django_metrics ENV prometheus_multiproc_dir "/tmp/prometheus_django_metrics" FROM base AS dev -RUN apt-get install -y sqlite3 default-mysql-client postgresql-client +RUN apk add sqlite mysql-client postgresql-client RUN pip install -r requirements-dev.txt FROM dev AS dev-enterprise diff --git a/engine/requirements.txt b/engine/requirements.txt index 6ac758a8..952d1dac 100644 --- a/engine/requirements.txt +++ b/engine/requirements.txt @@ -46,7 +46,7 @@ opentelemetry-instrumentation-celery==0.36b0 opentelemetry-instrumentation-pymysql==0.36b0 opentelemetry-instrumentation-wsgi==0.36b0 opentelemetry-exporter-otlp-proto-grpc==1.15.0 -pyroscope-io==0.8.1 +# pyroscope-io==0.8.1 django-dbconn-retry==0.1.7 django-ipware==4.0.2 django-anymail==8.6