Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
erikarasnick committed Dec 16, 2022
0 parents commit cf3c335
Show file tree
Hide file tree
Showing 18 changed files with 2,996 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# ignore everything
**

# except what we need
!/pm25_iweek_startdate.csv
!/habre.tif
!/renv.lock
!/entrypoint.R
40 changes: 40 additions & 0 deletions .github/workflows/build-deploy-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: build-deploy-pr
on:
pull_request:
jobs:
deploy-images:
runs-on: ubuntu-latest
env:
registry: ghcr.io
username: degauss-org
repository: habre_pm
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
- name: create latest tag variable
run: |
container="${{ env.registry }}/${{ env.username}}/${{ env.repository }}:latest"
echo "container=${container}" >> $GITHUB_ENV
- name: create pull request tag variable based on name of associated branch
if: github.event_name == 'pull_request'
run: |
versioned="${{ env.registry }}/${{ env.username}}/${{ env.repository }}:${GITHUB_HEAD_REF}"
echo "versioned=${versioned}" >> $GITHUB_ENV
- name: build container
run: |
docker build -t ${{ env.container }} .
- name: test run container
run: |
docker run --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file_geocoded.csv
- name: login to ghcr
uses: docker/login-action@v1
with:
registry: ${{ env.registry }}
username: ${{ env.username }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: deploy pull request container
run: |
docker tag ${{ env.container }} ${{ env.versioned }}
docker push ${{ env.versioned }}
42 changes: 42 additions & 0 deletions .github/workflows/build-deploy-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: build-deploy-release
on:
release:
types: [published]
jobs:
deploy-images:
runs-on: ubuntu-latest
env:
registry: ghcr.io
username: degauss-org
repository: habre_pm
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
- name: create latest tag variable
run: |
container="${{ env.registry }}/${{ env.username}}/${{ env.repository }}:latest"
echo "container=${container}" >> $GITHUB_ENV
- name: create release tag variable
if: github.event_name == 'release'
run: |
versioned="${{ env.registry }}/${{ env.username}}/${{ env.repository }}:${GITHUB_REF##*/}"
echo "versioned=${versioned}" >> $GITHUB_ENV
- name: build container
run: |
docker build -t ${{ env.container }} .
- name: test container
run: |
docker run --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file_geocoded.csv
- name: login to ghcr
uses: docker/login-action@v1
with:
registry: ${{ env.registry }}
username: ${{ env.username }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: deploy release (and latest) container
run: |
docker tag ${{ env.container }} ${{ env.versioned }}
docker push ${{ env.versioned }}
docker push ${{ env.container }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM rocker/r-ver:4.2.2

# DeGAUSS container metadata
ENV degauss_name="habre_pm"
ENV degauss_version="0.1.0"
ENV degauss_description="weekly pm2.5 for California (Habre)"

# add OCI labels based on environment variables too
LABEL "org.degauss.name"="${degauss_name}"
LABEL "org.degauss.version"="${degauss_version}"
LABEL "org.degauss.description"="${degauss_description}"

RUN R --quiet -e "install.packages('remotes', repos = c(CRAN = 'https://packagemanager.rstudio.com/all/__linux__/focal/latest'))"

RUN R --quiet -e "remotes::install_github('rstudio/[email protected]')"

WORKDIR /app

RUN apt-get update \
&& apt-get install -yqq --no-install-recommends \
libgdal-dev \
libgeos-dev \
libudunits2-dev \
libproj-dev \
&& apt-get clean

COPY renv.lock .

RUN R --quiet -e "renv::restore()"

COPY habre.tif .
COPY pm25_iweek_startdate.csv .
COPY entrypoint.R .

WORKDIR /tmp

ENTRYPOINT ["/app/entrypoint.R"]
Loading

0 comments on commit cf3c335

Please sign in to comment.