Skip to content

Commit

Permalink
Merge pull request #1 from RENCI/deploy_upgrade
Browse files Browse the repository at this point in the history
Deploy upgrade
  • Loading branch information
PhillipsOwen authored Sep 8, 2022
2 parents 2b7484c + aa8a850 commit d55c233
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 51 deletions.
33 changes: 15 additions & 18 deletions .github/workflows/image-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,42 @@

name: Create and publish the APSVIZ UI Data Docker image tagged with "latest" and version number

# trigger event is publishing the repo
# trigger event is publishing a release in the repo
on:
release:
types: [published]

# working parameters that are specific to this script
env:
REGISTRY: containers.renci.org/eds
NAME: apsviz-ui-data
USER: ${{ secrets.USER }}
PW: ${{ secrets.PW }}
REGISTRY: containers.renci.org/eds/apsviz-ui-data

# job definition
jobs:
# job definition
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

# job steps
steps:
# pull in the code repo
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to containers.renci.org
uses: docker/login-action@v2
with:
registry: containers.renci.org
username: ${{ secrets.USER }}
password: ${{ secrets.PW }}

# get the tags for the image
# get the tag for the image
- name: Get the version
id: get_version
run: |
echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
# build and push the image
# build and push the image. The docker v3 action automatically handles the git checkout.
- name: Build/Push the image to the registry
uses: docker/build-push-action@v1
uses: docker/build-push-action@v3
with:
repository: ${{ env.NAME }}
registry: ${{ env.REGISTRY }}
username: ${{ env.USER }}
password: ${{ env.PW }}
tags: latest,${{ steps.get_version.outputs.VERSION }}
push: true
tags: |
${{ env.REGISTRY }}:latest
${{ env.REGISTRY }}:${{ steps.get_version.outputs.VERSION }}
40 changes: 11 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,22 @@
# gets the apsviz-ui-data repo
# and runs main which starts the web server

FROM renciorg/renci-python-image:v0.0.1
# leverage the renci python base image
FROM python:3.9-slim

# get some credit
LABEL maintainer="[email protected]"

# install basic tools
RUN apt-get update

# create log level env param (debug=10, info=20)
ENV LOG_LEVEL 20

# make a directory for the repo
RUN mkdir /repo

# go to the directory where we are going to upload the repo
WORKDIR /repo

# get the latest code
RUN git clone https://github.com/RENCI/apsviz-ui-data.git
# create a new non-root user and switch to it
RUN useradd --create-home -u 1000 nru
USER nru

# go to the repo dir
# Create the directory for the code and cd to it
WORKDIR /repo/apsviz-ui-data

# make sure everything is read/write in the repo code
RUN chmod 777 -R .

# install requirements
# Copy in just the requirements first for caching purposes
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt

# switch to the non-root user (nru). defined in the base image
USER nru

# expose the default port
EXPOSE 4000
# Copy in the rest of the code
COPY . .

# start the service entry point
ENTRYPOINT ["python", "main.py"]
ENTRYPOINT ["python", "main.py"]
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# SPDX-License-Identifier: LicenseRef-RENCI
# SPDX-License-Identifier: MIT

pydantic==1.9.2
fastapi==0.81.0
pydantic==1.10.2
fastapi==0.82.0
uvicorn==0.18.3
pyyaml==6.0
psycopg2==2.9.3
psycopg2-binary==2.9.3
2 changes: 1 addition & 1 deletion src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from src.pg_utils import PGUtils

# set the app version
APP_VERSION = 'v0.0.2'
APP_VERSION = 'v0.0.3'

# get the log level and directory from the environment.
# level comes from the container dockerfile, path comes from the k8s secrets
Expand Down

0 comments on commit d55c233

Please sign in to comment.