Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Script recalcul calque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ERASME
Script recalcul calque
Commits
d2027c69
Commit
d2027c69
authored
2 years ago
by
Pierre-Gilles Levallois
Browse files
Options
Downloads
Patches
Plain Diff
First version of Pyrthon docker image
parent
600e224e
No related branches found
No related tags found
2 merge requests
!3
Launch script
,
!2
Refactoring : all scripts in Dockerfiles/python/scripts
Pipeline
#43830
canceled
2 years ago
Stage: Build Calqul
Stage: Deploy Calqul
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Dockerfiles/python/Dockerfile
+139
-15
139 additions, 15 deletions
Dockerfiles/python/Dockerfile
with
139 additions
and
15 deletions
Dockerfiles/python/Dockerfile
+
139
−
15
View file @
d2027c69
FROM
python:latest
##################################################################################
# Taken from https://github.com/Toblerity/Fiona/issues/1063
#
# testing image installation in interactive way :
# - docker run -i -t alpine /bin/sh
##################################################################################
# WORKDIR /usr/src/app
WORKDIR
/app
FROM
debian:buster-slim
# Basic libs and install python3.7
RUN
apt-get update
&&
apt-get upgrade
-y
\
&& apt-get install -y procps wget python3.7 python3-pip gdal-bin libgdal-dev apt-utils \
&& apt-get clean \
apt-get -y install proj proj-dev && \
# https://stackoverflow.com/questions/70508775/error-could-not-build-wheels-for-pycairo-which-is-required-to-install-pyprojec
# apt-get install -y sox ffmpeg libcairo2 libcairo2-dev texlive-full && \
apt-get install -y libcairo2 libcairo2-dev && \
rm -rf /var/lib/apt/lists/*
# Setting some ENV variables
ENV
CPLUS_INCLUDE_PATH="/usr/include/gdal"
ENV
C_INCLUDE_PATH="/usr/include/gdal"
ENV
PROJ_LIB="/usr/local/lib/python3.7/dist-packages/pyproj/proj_dir/share/proj"
ENV
GDAL_DATA="/usr/local/lib/python3.7/dist-packages/fiona/gdal_data/"
COPY
./scripts/pip_geopandas.txt pip_geopandas.sh
COPY
./scripts/requirements.txt requirements.txt
# for pyproj dependency
# RUN export PROJ_DIR=/usr/share/pyproj
# RUN export PROJ_DIR=/usr/local
# RUN export PROJ_WHEEL=true
# RUN pip install pyproj
RUN
apt-get update
&&
apt-get
install
proj-bin
-y
RUN
chmod
+x pip_geopandas.sh
&&
./pip_geopandas.sh
RUN
pip
install
--no-cache-dir
-r
requirements.txt
# Pip
RUN
python3
-m
pip
install
--no-cache-dir
--upgrade
pip
\
&& pip install --no-cache-dir --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version` \
&& pip install --no-cache-dir --ignore-installed PyYAML \
# https://stackoverflow.com/questions/70508775/error-could-not-build-wheels-for-pycairo-which-is-required-to-install-pyprojec
&& pip install --no-cache-dir manimlib \
&& pip install --no-cache-dir manimce \
#
&& pip install --no-cache-dir --upgrade -r requirements.txt
# Add a non root user (OpenShift Requirements)
RUN
addgroup calquluser
&&
\
useradd calquluser -g calquluser --home /app && \
mkdir -p /app && \
chown calquluser:calquluser /app
WORKDIR
/app
COPY
--chown=calquluser:calquluser / /app
USER
calquluser
COPY
./scripts ./
COPY
./sql ./
COPY
./env.$NAMESPACE_ENV ./
# COPY ./env.$NAMESPACE_ENV ./
# Launch calculation
CMD
[ "python3", "./scripts/hello-world.py" ]
# 3. ####################################################
# FROM alpine:latest
# ENV LC_ALL=C.UTF-8
# ENV LANG=C.UTF-8
# ENV PROJ_DIR=/usr
# # Python installation stuff
# RUN apk add --update --no-cache python3 && \
# apk add --no-cache python3-dev py3-pip alpine-sdk && \
# apk add proj proj-dev && \
# apk add proj-util
# COPY ./scripts/requirements.txt requirements.txt
# RUN pip3 install --upgrade pip && \
# pip3 install --upgrade setuptools && \
# pip3 install --no-cache-dir -r requirements.txt
# # Add a non root user (OpenShift Requirements)
# RUN addgroup -S calquluser && \
# adduser -S calquluser -G calquluser -h /app && \
# chown calquluser:calquluser /app
# WORKDIR /app
# COPY --chown=calquluser:calquluser / /app
# USER calquluser
# COPY ./scripts ./
# COPY ./sql ./
# # COPY ./env.$NAMESPACE_ENV ./
# # Launch calculation
# CMD [ "python3", "./scripts/hello-world.py" ]
# 2. ####################################################
# FROM python:3-alpine
# WORKDIR /app
# RUN mkdir -p /usr/bin/proj && chmod 755 /usr/bin/proj
# ENV PROJ_DIR=/usr
# RUN apk add --no-cache build-base proj proj-dev
# RUN pip install --upgrade pip
# RUN pip install --user pyproj
# COPY ./scripts/requirements.txt requirements.txt
# RUN pip install --no-cache-dir -r requirements.txt
# COPY ./scripts ./
# COPY ./sql ./
# # COPY ./env.$NAMESPACE_ENV ./
# CMD [ "python3", "./scripts/hello-world.py" ]
# 1. ###################################################
# # FROM python:latest
# # WORKDIR /usr/src/app
# WORKDIR /app
# # https://github.com/phusion/baseimage-docker/issues/58
# RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
# # clean and update sources
# RUN apt clean && apt update && apt install debconf-utils -qy
# RUN apt install libgirepository1.0-dev -qy
# RUN apt install proj-bin -qy
# RUN pip install --upgrade pip
# # for pyproj dependency
# # RUN export PROJ_DIR=/usr/local
# # RUN export PROJ_WHEEL=true
# # RUN pip install pyproj
# COPY ./scripts/requirements.txt requirements.txt
# RUN pip install --no-cache-dir -r requirements.txt
# COPY ./scripts ./
# COPY ./sql ./
# # COPY ./env.$NAMESPACE_ENV ./
# RUN ls -l .
# CMD [ "python3", "./scripts/hello-world.py" ]
RUN
ls
-l
.
CMD
[ "python3", "./scripts/hello-world.py" ]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment