-
Notifications
You must be signed in to change notification settings - Fork 22
/
Dockerfile
66 lines (57 loc) · 2.54 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
FROM continuumio/miniconda3:latest
# Add the mamba solver for faster builds
RUN conda install -n base conda-libmamba-solver
RUN conda config --set solver libmamba
# Clone the weather-tools and create conda env using environment.yml of weather-tools.
ARG weather_tools_git_rev=main
RUN git clone https://github.com/google/weather-tools.git /weather
WORKDIR /weather
RUN git checkout "${weather_tools_git_rev}"
RUN rm -r /weather/weather_*/test_data/
RUN conda env create -f environment.yml -n weather-tools-with-arco-era5 --debug
# Activate the conda env and update the PATH
ARG CONDA_ENV_NAME=weather-tools-with-arco-era5
RUN echo "source activate ${CONDA_ENV_NAME}" >> ~/.bashrc
ENV PATH /opt/conda/envs/${CONDA_ENV_NAME}/bin:$PATH
RUN pip install -e .
# Install gcloud alpha
RUN apt-get update -y
RUN gcloud components install alpha --quiet
# Clone the arco-era5 and add dependency into the environment.
ARG arco_era5_git_rev=main
RUN git clone https://github.com/google-research/arco-era5.git /arco-era5
WORKDIR /arco-era5
RUN git checkout "${arco_era5_git_rev}"
RUN pip install -e .
ENV PROJECT='<PROJECT_ID>'
ENV REGION='<REGION>'
ENV BUCKET='<BUCKET_NAME>'
ENV MANIFEST_LOCATION='fs://manifest?projectId=PROJECT_ID'
ENV API_KEY_1='projects/PROJECT/secrets/SECRET_NAME/versions/1'
ENV API_KEY_2='projects/PROJECT/secrets/SECRET_NAME/versions/1'
ENV WEATHER_TOOLS_SDK_CONTAINER_IMAGE='WEATHER_TOOLS_SDK_CONTAINER_IMAGE'
ENV ARCO_ERA5_SDK_CONTAINER_IMAGE='ARCO_ERA5_SDK_CONTAINER_IMAGE'
ENV BQ_TABLES_LIST='["xxx", "yyyy"]'
ENV REGION_LIST='["xxx", "yyyy"]'
ENV PYTHON_PATH='/opt/conda/envs/weather-tools-with-arco-era5/bin/python'
RUN apt-get update && apt-get -y install cron vim
COPY cron-file /etc/cron.d/crontab
RUN chmod 0644 /etc/cron.d/crontab
RUN ls /usr/bin/crontab
RUN /usr/bin/crontab /etc/cron.d/crontab
RUN touch /var/log/cron.log
CMD printenv | grep -v "no_proxy" >> /etc/environment && cron && tail -f /var/log/cron.log