Skip to content

Commit

Permalink
remove views
Browse files Browse the repository at this point in the history
  • Loading branch information
devincowan committed Oct 1, 2024
1 parent 44b9b36 commit d3c97f3
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 267 deletions.
2 changes: 2 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VUE_APP_BUCKET_URL_PUBLIC_PATH=/
VUE_APP_HYDROSHARE_URL=https://beta.hydroshare.org
52 changes: 52 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and Publish to Registry on Github push

env:
GITHUB_SHA: ${{ github.sha }}
REGISTRY_HOSTNAME: docker.io
REPOSITORY: ${{ secrets.DOCKER_REPOSITORY }}

on:
- push
- workflow_dispatch

jobs:
setup-build-publish-deploy:
name: Setup, Build, and Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare
id: prep
run: |
TAG=$(echo $GITHUB_SHA | head -c7)
IMAGE="${REPOSITORY}/hs_discover"
echo ::set-output name=tagged_image::${IMAGE}:${TAG}
echo ::set-output name=tag::${TAG}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Docker Hub Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-single-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-single-buildx
- name: Build
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.prep.outputs.tagged_image }}
cache-from: type=gha
cache-to: type=gha,mode=max
59 changes: 59 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
push:
tags: 'gh-pages*'
workflow_dispatch:

# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true

defaults:
run:
working-directory: '.'

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: create env file
run: |
touch .env
echo VITE_APP_API_URL=${{ secrets.VUE_APP_BUCKET_URL_PUBLIC_PATH }} >> .env
echo VITE_APP_FULL_URL=${{ secrets.VUE_APP_HYDROSHARE_URL }} >> .env
cp .env ../.env
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload dist repository
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
__pycache__
static
templates
templates
.env
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM node:14.14.0 as node-build

# Arg used by the node build for discovery app
# This is the path to the bucket where the static files are stored
# This should be the same as the STATIC_URL in the Django settings
ARG VUE_APP_BUCKET_URL_PUBLIC_PATH
ARG VUE_APP_HYDROSHARE_URL

ADD . /hydroshare

WORKDIR /hydroshare/hs_discover

RUN rm -rf static templates && \
mkdir static templates && \
mkdir templates/hs_discover && \
mkdir static/js && \
mkdir static/css && \
npm install && \
npm run build && \
mkdir -p static/js && \
mkdir -p static/css && \
cp -rp templates/hs_discover/js static/ && \
cp -rp templates/hs_discover/css static/ && \
cp -p templates/hs_discover/map.js static/js/ && \
echo "----------------js--------------------" && \
ls -l static/js && \
echo "--------------------------------------" && \
echo "----------------css-------------------" && \
ls -l static/css && \
echo "--------------------------------------"
3 changes: 2 additions & 1 deletion src/components/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,8 @@ export default {
this.typeFilter = [];
this.availabilityFilter = [];
}
axios.get('/discoverapi/', {
const hydroshareUrl = process.env.VUE_APP_HYDROSHARE_URL;
axios.get(`${hydroshareUrl}/discoverapi/`, {
params: {
q: this.searchtext,
sort: this.sortingBy,
Expand Down
Loading

0 comments on commit d3c97f3

Please sign in to comment.