kopia lustrzana https://github.com/projecthorus/chasemapper
Container updates
rodzic
53db1d81f5
commit
4a0c69be13
|
@ -0,0 +1,59 @@
|
||||||
|
name: Container Images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
main:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Calculate Container Metadata
|
||||||
|
id: meta
|
||||||
|
uses: crazy-max/ghaction-docker-meta@v1
|
||||||
|
with:
|
||||||
|
images: ghcr.io/${{ github.repository }}
|
||||||
|
|
||||||
|
- name: Setup QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
|
- name: Setup Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Cache Layers
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /tmp/buildx-cache
|
||||||
|
key: buildx-cache-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
buildx-cache-
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and Push Images
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64, linux/386, linux/arm64, linux/arm/v6, linux/arm/v7
|
||||||
|
cache-from: type=local,src=/tmp/buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/buildx-cache-new,mode=max
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ghcr.io/${{ github.repository }}:latest
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
|
- name: Move Cache
|
||||||
|
run: |
|
||||||
|
rm -rf /tmp/buildx-cache
|
||||||
|
mv /tmp/buildx-cache-new /tmp/buildx-cache
|
69
Dockerfile
69
Dockerfile
|
@ -1,40 +1,39 @@
|
||||||
# -------------------
|
# -------------------
|
||||||
# The build container
|
# The build container
|
||||||
# -------------------
|
# -------------------
|
||||||
FROM debian:buster-slim AS build
|
FROM python:3.7-buster AS build
|
||||||
|
|
||||||
# Update system packages and install build dependencies.
|
# Upgrade base packages.
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get upgrade -y && \
|
apt-get upgrade -y && \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
build-essential \
|
|
||||||
cmake \
|
cmake \
|
||||||
libglib2.0-dev \
|
libgdal-dev && \
|
||||||
python3 \
|
|
||||||
python3-dateutil \
|
|
||||||
python3-fastkml \
|
|
||||||
python3-flask \
|
|
||||||
python3-gdal \
|
|
||||||
python3-numpy \
|
|
||||||
python3-pip \
|
|
||||||
python3-requests \
|
|
||||||
python3-serial \
|
|
||||||
python3-setuptools \
|
|
||||||
python3-shapely \
|
|
||||||
unzip && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install additional Python packages that aren't available through apt-get.
|
# Copy in requirements.txt.
|
||||||
RUN pip3 --no-cache-dir install \
|
COPY requirements.txt \
|
||||||
flask-socketio \
|
/root/chasemapper/requirements.txt
|
||||||
pytz
|
|
||||||
|
# Install numpy Python package first so that it is available for gdal.
|
||||||
|
RUN pip3 --no-cache-dir install --user --no-warn-script-location \
|
||||||
|
--extra-index-url https://www.piwheels.org/simple \
|
||||||
|
numpy
|
||||||
|
|
||||||
|
# Install remaining Python packages.
|
||||||
|
RUN pip3 --no-cache-dir install --user --no-warn-script-location \
|
||||||
|
--extra-index-url https://www.piwheels.org/simple \
|
||||||
|
-r /root/chasemapper/requirements.txt
|
||||||
|
|
||||||
|
# Copy in chasemapper.
|
||||||
|
COPY . /root/chasemapper
|
||||||
|
|
||||||
# Download and install cusf_predictor_wrapper, and build predictor binary.
|
# Download and install cusf_predictor_wrapper, and build predictor binary.
|
||||||
ADD https://github.com/darksidelemm/cusf_predictor_wrapper/archive/master.zip /root/cusf_predictor_wrapper-master.zip
|
ADD https://github.com/darksidelemm/cusf_predictor_wrapper/archive/master.zip /root/cusf_predictor_wrapper-master.zip
|
||||||
RUN unzip /root/cusf_predictor_wrapper-master.zip -d /root && \
|
RUN unzip /root/cusf_predictor_wrapper-master.zip -d /root && \
|
||||||
rm /root/cusf_predictor_wrapper-master.zip && \
|
rm /root/cusf_predictor_wrapper-master.zip && \
|
||||||
cd /root/cusf_predictor_wrapper-master && \
|
cd /root/cusf_predictor_wrapper-master && \
|
||||||
python3 setup.py install && \
|
python3 setup.py install --user && \
|
||||||
cd src && \
|
cd src && \
|
||||||
mkdir build && \
|
mkdir build && \
|
||||||
cd build && \
|
cd build && \
|
||||||
|
@ -44,28 +43,20 @@ RUN unzip /root/cusf_predictor_wrapper-master.zip -d /root && \
|
||||||
# -------------------------
|
# -------------------------
|
||||||
# The application container
|
# The application container
|
||||||
# -------------------------
|
# -------------------------
|
||||||
FROM debian:buster-slim
|
FROM python:3.7-slim-buster
|
||||||
EXPOSE 5001/tcp
|
EXPOSE 5001/tcp
|
||||||
|
|
||||||
# Update system packages and install build dependencies.
|
# Upgrade base packages and install application dependencies.
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get upgrade -y && \
|
apt-get upgrade -y && \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
|
libgdal20 \
|
||||||
libglib2.0 \
|
libglib2.0 \
|
||||||
python3 \
|
tini && \
|
||||||
python3-dateutil \
|
|
||||||
python3-fastkml \
|
|
||||||
python3-flask \
|
|
||||||
python3-gdal \
|
|
||||||
python3-numpy \
|
|
||||||
python3-requests \
|
|
||||||
python3-serial \
|
|
||||||
python3-shapely \
|
|
||||||
unzip && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Copy any additional Python packages from the build container.
|
# Copy any additional Python packages from the build container.
|
||||||
COPY --from=build /usr/local/lib/python3.7/dist-packages /usr/local/lib/python3.7/dist-packages
|
COPY --from=build /root/.local /root/.local
|
||||||
|
|
||||||
# Copy predictor binary and get_wind_data.py from the build container.
|
# Copy predictor binary and get_wind_data.py from the build container.
|
||||||
COPY --from=build /root/cusf_predictor_wrapper-master/src/build/pred /opt/chasemapper/
|
COPY --from=build /root/cusf_predictor_wrapper-master/src/build/pred /opt/chasemapper/
|
||||||
|
@ -74,6 +65,14 @@ COPY --from=build /root/cusf_predictor_wrapper-master/apps/get_wind_data.py /opt
|
||||||
# Copy in chasemapper.
|
# Copy in chasemapper.
|
||||||
COPY . /opt/chasemapper
|
COPY . /opt/chasemapper
|
||||||
|
|
||||||
# Run horusmapper.py.
|
# Set the working directory.
|
||||||
WORKDIR /opt/chasemapper
|
WORKDIR /opt/chasemapper
|
||||||
|
|
||||||
|
# Ensure scripts from Python packages are in PATH.
|
||||||
|
ENV PATH=/root/.local/bin:$PATH
|
||||||
|
|
||||||
|
# Use tini as init.
|
||||||
|
ENTRYPOINT ["/usr/bin/tini", "--"]
|
||||||
|
|
||||||
|
# Run horusmapper.py.
|
||||||
CMD ["python3", "/opt/chasemapper/horusmapper.py"]
|
CMD ["python3", "/opt/chasemapper/horusmapper.py"]
|
||||||
|
|
Ładowanie…
Reference in New Issue