Skip to content

Commit

Permalink
wip1
Browse files Browse the repository at this point in the history
  • Loading branch information
EliMoshkovich committed Mar 19, 2024
1 parent b56da56 commit ee5db9d
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 21 deletions.
76 changes: 66 additions & 10 deletions .github/workflows/pdp_cicd.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Build and Push Docker Image
name: Build and Push PDP Docker Image
on: push
# release:
# types: [prereleased]
# types: [published]
jobs:
build-and-push:
build-and-push-pdp-vanilla:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -21,33 +21,89 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Pre build - for PDP-Vanilla
run: |
#echo "${{ github.event.release.tag_name }}" | cut -d '-' -f 1 > permit_pdp_version
echo "0.2.38" > permit_pdp_version
working-directory: ./permit-opa

- name: Build and push PDP-Vanilla - (official release)
if: "!github.event.release.prerelease"
uses: docker/build-push-action@v5
with:
push: false
context: .
platforms: linux/amd64,linux/arm64
tags: permitio/pdp-v2-vanilla:${{ github.event.release.tag_name }}, permitio/pdp-v2-vanilla:latest
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and push PDP-Vanilla image - (pre-release)
if: "github.event.release.prerelease"
uses: docker/build-push-action@v5
with:
push: false
context: .
platforms: linux/amd64,linux/arm64
tags: permitio/pdp-v2-vanilla:${{ github.event.release.tag_name }}
cache-from: type=gha
cache-to: type=gha,mode=max

build-and-push-pdp:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

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

- uses: actions/checkout@v3
with:
repository: permitio/permit-opa
ref: main
path: './permit-opa'
token: ${{ secrets.CLONE_REPO_TOKEN }}
- name: Run pre build

- name: Pre build PDP
run: |
pwd
#echo "${{ github.event.release.tag_name }}" | cut -d '-' -f 1 > permit_pdp_version
echo "0.2.38" > permit_pdp_version
rm -rf custom
mkdir custom
find * -name '*go*' -print0 | xargs -0 tar -czf ./custom/custom_opa.tar.gz --exclude '.*'
working-directory: ./permit-opa


- name: Build and push Docker image
- name: Build and push PDP image - (pre-release)
if: "github.event.release.prerelease"
uses: docker/build-push-action@v5
with:
push: false
context: .
platforms: linux/amd64,linux/arm64
tags: permitio/pdp-v2:${{ github.event.release.tag_name }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and push PDP image - (official release)
if: "!github.event.release.prerelease"
uses: docker/build-push-action@v5
with:
push: false
context: .
platforms: linux/amd64,linux/arm64
#tags: permitio/pdp-v2:${{ github.event.release.tag_name }}
tags: permitio/pdp-v2:test
tags: permitio/pdp-v2:${{ github.event.release.tag_name }},permitio/pdp-v2:latest
cache-from: type=gha
cache-to: type=gha,mode=max



22 changes: 11 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ WORKDIR /app/
COPY requirements.txt requirements.txt
RUN pip install --upgrade pip && pip install setuptools -U && pip install --user -r requirements.txt

# Install a custom OPAL, if requested
COPY ./permit-opa/custom /custom

RUN if [ -f /custom/custom_opal.tar.gz ]; \
then \
cd /custom && \
tar xzf custom_opal.tar.gz && \
pip install --user packages/opal-common packages/opal-client && \
cd / && \
rm -rf /custom ; \
fi
# # Install a custom OPAL, if requested
# COPY ./permit-opa/custom /custom

# RUN if [ -f /custom/custom_opal.tar.gz ]; \
# then \
# cd /custom && \
# tar xzf custom_opal.tar.gz && \
# pip install --user packages/opal-common packages/opal-client && \
# cd / && \
# rm -rf /custom ; \
# fi

COPY horizon setup.py MANIFEST.in ./
RUN python setup.py install --user
Expand Down

0 comments on commit ee5db9d

Please sign in to comment.