Skip to content

Commit

Permalink
fix: Fix CI issue with docker (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
NexSabre authored Nov 18, 2022
1 parent cae8fd1 commit f9bad57
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 52 deletions.
106 changes: 57 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
python-version: "3.11"
cache: "pip"
- name: Install Python dependencies (pip)
run: |
pip install -r requirements-dev.txt
Expand Down Expand Up @@ -48,6 +48,14 @@ jobs:
- name: Verify imports (w/isort)
run: |
isort --check ph/ tests/ --profile black
verify-docker:
name: Build a docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Docker build
run: |
docker build -t ph .
release:
name: Prepare release
if: ${{ github.ref == 'refs/heads/main' }}
Expand Down Expand Up @@ -91,56 +99,56 @@ jobs:
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:release web -a packet-helper
# push_to_registry_pr:
# name: Push Docker image to HerokuApp (as development env)
# if: ${{ github.ref != 'refs/heads/main' }}
# needs: [verify-django, verify-js, verify-python]
# runs-on: ubuntu-latest
# environment:
# name: development
# url: https://packet-helper-pr.herokuapp.com/
# steps:
# - name: Checkout repository
# uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - name: Add SHORT_SHA env property with commit short sha
# run: |
# echo "GIT_VERSION_TAG=`git describe --tags --abbrev=0`" >> $GITHUB_ENV
# echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
# - name: Login to Heroku Container registry
# env:
# HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
# run: heroku container:login
# - name: Build and push
# env:
# HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
# run: |
# heroku container:push web -a packet-helper-pr --arg PH_VER="${GIT_VERSION_TAG}:${SHORT_SHA}"
# - name: Release
# env:
# HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
# run: heroku container:release web -a packet-helper-pr
# post_deploy_check_pr:
# name: Check status of env (as development env)
# if: ${{ github.ref != 'refs/heads/main' }}
# needs: [ push_to_registry_pr ]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - name: Verify /api/info
# run: |
# pip install requests pydantic
# export GIT_VERSION_TAG=`git describe --tags --abbrev=0`
# export SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`
# python check_deployment.py https://packet-helper-pr.herokuapp.com $GIT_VERSION_TAG $SHORT_SHA
# push_to_registry_pr:
# name: Push Docker image to HerokuApp (as development env)
# if: ${{ github.ref != 'refs/heads/main' }}
# needs: [verify-django, verify-js, verify-python]
# runs-on: ubuntu-latest
# environment:
# name: development
# url: https://packet-helper-pr.herokuapp.com/
# steps:
# - name: Checkout repository
# uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - name: Add SHORT_SHA env property with commit short sha
# run: |
# echo "GIT_VERSION_TAG=`git describe --tags --abbrev=0`" >> $GITHUB_ENV
# echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
# - name: Login to Heroku Container registry
# env:
# HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
# run: heroku container:login
# - name: Build and push
# env:
# HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
# run: |
# heroku container:push web -a packet-helper-pr --arg PH_VER="${GIT_VERSION_TAG}:${SHORT_SHA}"
# - name: Release
# env:
# HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
# run: heroku container:release web -a packet-helper-pr
# post_deploy_check_pr:
# name: Check status of env (as development env)
# if: ${{ github.ref != 'refs/heads/main' }}
# needs: [ push_to_registry_pr ]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - name: Verify /api/info
# run: |
# pip install requests pydantic
# export GIT_VERSION_TAG=`git describe --tags --abbrev=0`
# export SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`
# python check_deployment.py https://packet-helper-pr.herokuapp.com $GIT_VERSION_TAG $SHORT_SHA
post_deploy_check_prod:
name: Check status of env (as production env)
if: ${{ github.ref != 'refs/heads/main' }}
needs: [ push_to_registry ]
needs: [push_to_registry]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# build stage (frontend)
FROM node:lts-alpine as build-stage
FROM node:lts-alpine@sha256:2175727cef5cad4020cb77c8c101d56ed41d44fbe9b1157c54f820e3d345eab1 as build-stage
WORKDIR /app
COPY package*.json ./
COPY package.json yarn.lock ./

RUN yarn -g install
COPY . .
RUN yarn build

# build stage (backend & package)
FROM python:3.11-buster
FROM python:3.11-buster@sha256:43db725cf6c954611ffe4938e330e8d18b48627ad19e4f1ed62196baf5a3ca58

# Install tshark/wireshark dependecies
RUN echo "wireshark-common wireshark-common/install-setuid boolean true" | debconf-set-selections
Expand Down

0 comments on commit f9bad57

Please sign in to comment.