Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/build/docker/multiplatform'
Browse files Browse the repository at this point in the history
# Conflicts:
#	poetry.lock
  • Loading branch information
Vixtir committed Oct 31, 2023
2 parents 89f8e10 + feb70e8 commit e44a929
Show file tree
Hide file tree
Showing 6 changed files with 1,740 additions and 1,910 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.fleet
.git
config_examples
.github
Dockerfile
7 changes: 6 additions & 1 deletion .github/workflows/build_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
platforms: linux/amd64, linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:test
labels: ${{ steps.meta.outputs.labels }}
38 changes: 17 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
FROM python:3.9.16-slim AS python
FROM python:3 AS python
ENV PYTHONUNBUFFERED=true
ENV PATH=$PATH:/root/.local/bin
WORKDIR /app

FROM python AS build
RUN apt-get update && \
apt-get install -y \
curl \
libpq-dev \
gcc \
unixodbc \
unixodbc-dev

RUN curl -s -o microsoft.asc https://packages.microsoft.com/keys/microsoft.asc \
&& curl -s -o mssql-release.list https://packages.microsoft.com/config/debian/10/prod.list \
&& apt-get install -y g++

RUN curl -s -o microsoft.asc https://packages.microsoft.com/keys/microsoft.asc \
&& curl -s -o mssql-release.list https://packages.microsoft.com/config/debian/10/prod.list \
&& apt-get install -y g++

RUN curl -sSL https://install.python-poetry.org | python3 -

FROM python AS build
unixodbc-dev \
g++ \
python-dev \
python3-dev

# For pyodbc
ENV ACCEPT_EULA=Y
RUN apt-get install -y gnupg2

RUN curl -s -o microsoft.asc https://packages.microsoft.com/keys/microsoft.asc \
&& curl -s -o mssql-release.list https://packages.microsoft.com/config/debian/10/prod.list \
&& apt-get install -y g++ unixodbc-dev
&& apt-get install -y g++

RUN apt-key add microsoft.asc && rm microsoft.asc && mv mssql-release.list /etc/apt/sources.list.d/mssql-release.list
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
Expand All @@ -38,16 +31,19 @@ RUN apt-get install -y msodbcsql18
RUN apt-get install -y mssql-tools18
RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc

COPY poetry.lock pyproject.toml ./

RUN poetry config virtualenvs.create false
RUN poetry install --no-root --no-dev -vvv
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
COPY . .

RUN pip install --upgrade pip
RUN poetry install --no-interaction --only main

COPY odd_collector_profiler ./odd_collector_profiler
COPY collector_config.yaml ./

FROM python as runtime
RUN useradd --create-home --shell /bin/bash app
USER app
COPY start.sh ./start.sh
COPY --from=build /app /app

ENV PATH="/app/.venv/bin:$PATH"
ENTRYPOINT ["/bin/bash", "start.sh"]
4 changes: 2 additions & 2 deletions odd_collector_profiler/domain/collector_profiler_config.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from typing import Any, List
from typing import Any, List, Optional

from pyaml_env import parse_config
from pydantic import BaseSettings


class CollectorProfilerConfig(BaseSettings):
default_pulling_interval: int
default_pulling_interval: Optional[int] = None
token: str
profilers: List[Any]
platform_host_url: str
Expand Down
Loading

0 comments on commit e44a929

Please sign in to comment.