Skip to content

Commit

Permalink
Merge branch 'fix_docker' into 'master'
Browse files Browse the repository at this point in the history
Fix docker

See merge request 3d/cars-park/cars!792
  • Loading branch information
dyoussef committed Jan 3, 2025
2 parents fbe430c + 3bc67da commit 930ecc8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ FROM orfeotoolbox/otb:latest
LABEL maintainer="CNES"

# Dependencies packages
RUN apt-get update && apt install software-properties-common -y && add-apt-repository ppa:deadsnakes/ppa
# hadolint ignore=DL3008
RUN apt-get update && apt-get install --no-install-recommends software-properties-common -y && add-apt-repository ppa:deadsnakes/ppa && rm -rf /var/lib/apt/lists/*

# hadolint ignore=DL3008
RUN apt-get update && apt-get install --no-install-recommends -y --quiet \
Expand All @@ -20,22 +21,19 @@ RUN apt-get update && apt-get install --no-install-recommends -y --quiet \
# copy and install cars with mccnn plugin capabilities installed (but not configured by default)
WORKDIR /app

RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
# Create a virtual environment
RUN python3 -m venv /app/venv
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 && python3 -m venv /app/venv

# source venv/bin/activate in docker mode
ENV VIRTUAL_ENV='/app/venv'
ENV PATH="$VIRTUAL_ENV/bin:$PATH"


# Copy only necessary files for installation
COPY . /app/cars

# Install fiona and rasterio with gdal / proj from otb
WORKDIR /app/cars
RUN CARS_VENV=$VIRTUAL_ENV make clean && CARS_VENV=$VIRTUAL_ENV make install-gdal-dev

RUN echo "CARS installation" && CARS_VENV=$VIRTUAL_ENV make clean && CARS_VENV=$VIRTUAL_ENV make install-gdal-dev
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

# hadolint ignore=DL3013,SC2102
RUN python -m pip cache purge
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,15 @@ docker-deps: ## Check and build docker image cnes/cars-deps
@docker pull hadolint/hadolint
@echo "Check Dockerfile with hadolint"
@docker run --rm -i hadolint/hadolint < Dockerfile
@echo "Hadolint ok"

.PHONY: docker
docker: docker-deps ## Check and build docker image cnes/cars
@echo "Build Docker main image CARS ${CARS_VERSION_MIN}"
docker: docker-deps ## Check and build docker image cnes/cars
# Set docker options like --build-arg
ifndef DOCKER_OPTIONS
@docker build -t cnes/cars:${CARS_VERSION_MIN} -t cnes/cars:latest . -f Dockerfile
@docker build -t cnes/cars -t cnes/cars:latest . -f Dockerfile
else
@docker build ${DOCKER_OPTIONS} -t cnes/cars:${CARS_VERSION_MIN} -t cnes/cars:latest . -f Dockerfile
@docker build ${DOCKER_OPTIONS} -t cnes/cars -t cnes/cars:latest . -f Dockerfile
endif


Expand Down

0 comments on commit 930ecc8

Please sign in to comment.