Skip to content

Commit

Permalink
Merge pull request #82 from raphaelrpl/big-tmp
Browse files Browse the repository at this point in the history
📚 review examples/python docker and improve command line version
  • Loading branch information
raphaelrpl authored Oct 3, 2023
2 parents 26ca6ed + 0c4c15e commit b30b9d2
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 43 deletions.
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Changes
=======


Version 1.0.0 (2023-10-03)
--------------------------
Version 1.0.0.dev1 (2023-10-03)
-------------------------------

- Review module dependencies
- Add driver for Copernicus DataSpace EcoSystem.
Expand Down
32 changes: 31 additions & 1 deletion bdc_collectors/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,37 @@
from . import create_app


@click.group(cls=FlaskGroup, create_app=create_app)
def get_version(ctx, param, value):
"""Retrieve the package version for command line."""
if not value or ctx.resilient_parsing:
return

import platform
from . import __version__

click.echo(
f"Python {platform.python_version()}\n"
f"BDC-Collector {__version__}",
color=ctx.color,
)
ctx.exit()


version_option = click.Option(
["--version"],
help="Show the application version.",
expose_value=False,
callback=get_version,
is_flag=True,
is_eager=True,
)


@click.group(cls=FlaskGroup,
create_app=create_app,
add_default_commands=False,
add_version_option=False,
params=[version_option])
def cli():
"""Command line for BDC-Collectors."""
click.secho("""BDC-Collectors Copyright (C) 2023 INPE
Expand Down
2 changes: 1 addition & 1 deletion bdc_collectors/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@

"""Version information for BDC-Collectors."""

__version__ = '1.0.0'
__version__ = '1.0.0.dev1'
88 changes: 49 additions & 39 deletions examples/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,50 @@
#
# This file is part of Brazil Data Cube BDC-Collectors.
# Copyright (C) 2022 INPE.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
#

FROM python:3.8.6

ENV START_DATE ''
ENV END_DATE ''
ENV DELTA_DAYS ''
ENV DATA_DIR ''
ENV SHP_DATA_DIR ''
ENV S2_GRID_NAME ''
ENV BDC_CREODIAS_USER ''
ENV BDC_CREODIAS_PASSWORD ''

COPY . /app

WORKDIR /app

RUN pip3 install -U pip && \
pip3 install -U setuptools && \
pip3 install wheel && \
pip3 install -e .[all] && \
pip3 install fiona

#
# This file is part of Brazil Data Cube BDC-Collectors.
# Copyright (C) 2023 INPE.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
#

ARG GIT_COMMIT
ARG BASE_IMAGE=python:3.11-bullseye
FROM ${BASE_IMAGE}

ARG GIT_COMMIT

LABEL "org.repo.maintainer"="Brazil Data Cube <[email protected]>"
LABEL "org.repo.title"="Docker image for BDC Collectors - Examples"
LABEL "org.repo.description"="Docker image to collect data from multiple providers."
LABEL "org.repo.git_commit"="${GIT_COMMIT}"

# Build arguments"
ARG APP_INSTALL_PATH="/opt/bdc-collectors"

ENV START_DATE ''
ENV END_DATE ''
ENV DELTA_DAYS ''
ENV DATA_DIR ''
ENV SHP_DATA_DIR ''
ENV S2_GRID_NAME ''
ENV BDC_CREODIAS_USER ''
ENV BDC_CREODIAS_PASSWORD ''

COPY . ${APP_INSTALL_PATH}

WORKDIR ${APP_INSTALL_PATH}

RUN pip3 install -U pip setuptools wheel --no-cache && \
pip3 install -e .[docs,tests,raster] --no-cache && \
pip3 install fiona --no-cache

CMD ["python3", "examples/download_sentinel_tile.py"]

0 comments on commit b30b9d2

Please sign in to comment.