-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from ghrcdaac/mlh0079-5315-repo-consolidation
- Attempting to merge the docker repo.
- Loading branch information
Showing
21 changed files
with
1,015 additions
and
744 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Push To Docker hub | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get tag version | ||
id: tag_name | ||
run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ghrcdaac/dmrpp-generator:${{ steps.tag_name.outputs.SOURCE_TAG }} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM opendap/besd:3.20.13-664 | ||
RUN yum -y update && \ | ||
yum -y upgrade | ||
HEALTHCHECK NONE | ||
# Adding a user | ||
RUN adduser worker | ||
RUN yum install -y nano && \ | ||
yum install -y wget | ||
USER worker | ||
WORKDIR /home/worker | ||
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py38_4.8.2-Linux-x86_64.sh && \ | ||
bash Miniconda3-py38_4.8.2-Linux-x86_64.sh -b && \ | ||
rm Miniconda3-py38_4.8.2-Linux-x86_64.sh | ||
ENV HOME="/home/worker" PATH="/home/worker/miniconda3/bin:${PATH}" | ||
RUN pip install ipython &&\ | ||
pip install pytest | ||
RUN mkdir $HOME/build | ||
ENV BUILD=$HOME/build | ||
COPY --chown=worker setup.py requirements*txt $BUILD/ | ||
RUN pip install -r $BUILD/requirements.txt | ||
COPY --chown=worker dmrpp_generator $BUILD/dmrpp_generator | ||
COPY --chown=worker generate_dmrpp.py $BUILD/generate_dmrpp.py | ||
COPY --chown=worker tests $BUILD/tests | ||
RUN \ | ||
cd $BUILD; \ | ||
python setup.py install | ||
WORKDIR $BUILD | ||
RUN pytest --junitxml=./test_results/test_dmrpp_generator.xml tests && \ | ||
rm -rf tests | ||
CMD ["python", "generate_dmrpp.py"] | ||
ENTRYPOINT [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,59 @@ | ||
#!/bin/bash | ||
set -ex | ||
export VERSION=$1 | ||
export RELEASE_NAME=`basename $GITHUB_REPO` | ||
export RELEASE_NAME=$(basename "$GITHUB_REPO") | ||
|
||
## Create Release | ||
export RELEASE_URL=$(curl -H\ | ||
"Authorization: token $GITHUB_TOKEN"\ | ||
-d "{\"tag_name\": \"$VERSION\", \"target_commitsh\": \"$VERSION\", \"name\": \"$VERSION\", \"body\": \"Release $VERSION\" }"\ | ||
-H "Content-Type: application/json"\ | ||
-X POST\ | ||
https://api.github.com/repos/$GITHUB_REPO/releases |grep \"url\" |grep releases |sed -e 's/.*\(https.*\)\"\,/\1/'| sed -e 's/api/uploads/') | ||
https://api.github.com/repos/"$GITHUB_REPO"/releases \ | ||
| grep \"url\" | grep releases | sed -e 's/.*\(https.*\)\"\,/\1/' | sed -e 's/api/uploads/') | ||
|
||
|
||
|
||
## Build TF modules that require source building | ||
function create_zip_file() { | ||
|
||
BUILD_DIR=/tmp/${RELEASE_NAME} | ||
DESTINATION_DIR=${PWD}/dist | ||
rm -rf ${DESTINATION_DIR} | ||
mkdir -p ${BUILD_DIR} ${DESTINATION_DIR} | ||
cp -r modules ${BUILD_DIR} | ||
cp *tf ${BUILD_DIR} | ||
cd ${BUILD_DIR} | ||
rm -rf "${DESTINATION_DIR}" | ||
mkdir -p "${BUILD_DIR}" "${DESTINATION_DIR}" | ||
cp -r modules "${BUILD_DIR}" | ||
cp -- *tf "${BUILD_DIR}" | ||
cd "${BUILD_DIR}" | ||
sed -i "s/VERSION_SUB/${VERSION}/g" variables.tf | ||
zip -r9 ${RELEASE_NAME}.zip . | ||
mv ${RELEASE_NAME}.zip ${DESTINATION_DIR}/. | ||
cd $DESTINATION_DIR | ||
rm -rf ${BUILD_DIR} | ||
zip -r9 "${RELEASE_NAME}".zip . | ||
mv "${RELEASE_NAME}".zip "${DESTINATION_DIR}"/. | ||
cd "$DESTINATION_DIR" | ||
rm -rf "${BUILD_DIR}" | ||
} | ||
|
||
|
||
function create_wheel() { | ||
pip install -r requirements_dev.txt | ||
python -m build --wheel --outdir . . | ||
} | ||
|
||
#### Release package | ||
create_zip_file | ||
|
||
### Post the release | ||
curl -X POST -H "Authorization: token $GITHUB_TOKEN" --data-binary "@${RELEASE_NAME}.zip" -H "Content-type: application/octet-stream" $RELEASE_URL/assets?name=${RELEASE_NAME}.zip | ||
|
||
## Create Release for dmrpp docker image | ||
curl -H\ | ||
"Authorization: token $GITHUB_TOKEN"\ | ||
-d "{\"tag_name\": \"$VERSION\", \"target_commitsh\": \"$VERSION\", \"name\": \"$VERSION\", \"body\": \"Release $VERSION https://ghrcdaac.github.io/dmrpp-generator\" }"\ | ||
-H "Content-Type: application/json"\ | ||
-X POST\ | ||
https://api.github.com/repos/$GUTHUB_DOCKER_IMAGE/releases | ||
curl -X POST \ | ||
-H "Authorization: token $GITHUB_TOKEN" --data-binary "@${RELEASE_NAME}.zip" \ | ||
-H "Content-type: application/octet-stream" \ | ||
"$RELEASE_URL"/assets?name="${RELEASE_NAME}".zip | ||
|
||
### Create and post the wheel | ||
cd ../ | ||
create_wheel | ||
content=$(cat ./dmrpp_generator/version.py) | ||
[[ $content =~ ([0-9]+.[0-9]+.[0-9]+) ]] | ||
curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer $GITHUB_TOKEN" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-H "Content-Type: application/octet-stream" \ | ||
"$RELEASE_URL/assets?name=dmrpp_file_generator-${BASH_REMATCH[1]}-py3-none-any.whl" \ | ||
--data-binary "@dmrpp_file_generator-${BASH_REMATCH[1]}-py3-none-any.whl" |
Empty file.
Oops, something went wrong.