From 75e48ec40be31192cf5111f9c18cc5572c6335cc Mon Sep 17 00:00:00 2001 From: Maria Carmina <50501033+mariacarmina@users.noreply.github.com> Date: Fri, 6 Oct 2023 14:59:49 +0300 Subject: [PATCH] Optimize Dockerfile. (#668) * First try of optimizing Dockerfile. * Progress: 437 MB * Fix workflow. --- .github/workflows/pytest.yml | 5 +++++ Dockerfile | 21 ++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index bae881b1..abdcb6e1 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -47,11 +47,16 @@ jobs: docker image rm node:16-alpine docker image rm node:18 docker image rm node:18-alpine + docker image rm node:20 + docker image rm node:20-alpine docker image rm buildpack-deps:buster docker image rm buildpack-deps:bullseye docker image rm debian:10 docker image rm debian:11 docker image rm moby/buildkit:latest + docker image rm alpine:3.16 + docker image rm alpine:3.17 + docker image rm alpine:3.18 - name: Wait for contracts deployment and C2D cluster to be ready working-directory: ${{ github.workspace }}/barge run: | diff --git a/Dockerfile b/Dockerfile index cb075983..b852d31e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,26 +2,25 @@ ## Copyright 2023 Ocean Protocol Foundation ## SPDX-License-Identifier: Apache-2.0 ## -FROM ubuntu:18.04 +FROM python:3.8-slim-buster LABEL maintainer="Ocean Protocol " ARG VERSION RUN apt-get update && \ - apt-get install --no-install-recommends -y \ - gcc \ - python3.8 \ - python3-pip \ - python3.8-dev \ - gettext-base + apt-get install --no-install-recommends -y \ + build-essential \ + gcc \ + gettext-base && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* COPY . /ocean-provider WORKDIR /ocean-provider -RUN python3.8 -m pip install --upgrade pip -RUN python3.8 -m pip install setuptools -RUN python3.8 -m pip install wheel -RUN python3.8 -m pip install . +# Install dependencies in a virtual environment +RUN python3.8 -m pip install --no-cache-dir setuptools wheel && \ + python3.8 -m pip install --no-cache-dir . ENV NETWORK_URL='http://127.0.0.1:8545'