From 69861dff11d5b67ad234b35f3dbbf1a7911691e4 Mon Sep 17 00:00:00 2001 From: "Jon (JR) Price" Date: Sun, 4 Feb 2024 14:22:13 -0800 Subject: [PATCH] Added build action --- .github/workflows/build.yml | 28 ++++++++++++++++++++ .github/workflows/ci.yml | 51 ++++++++++++++++++++++++++++++++----- Dockerfile | 11 ++++++++ 3 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 Dockerfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..854daff --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,28 @@ +name: Build + +on: + push: + branches: [ "main" ] + +env: + SVC_NAME: sk-codename-svc + +jobs: + deploy: + name: Deploy to Registry + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + # TODO: Use this when ready to push + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + tags: zerodaysec/${{ env.SVC_NAME }}:main \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bc1b07..8c28061 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,16 +1,55 @@ +#VERSION=0.1 name: CI on: push +env: + SVC_NAME: sk-codename-svc + jobs: - gitHubActionForPylint: - name: GitHub Action for pylint + pylint: + name: Pylint runs-on: ubuntu-latest steps: - uses: actions/checkout@master + - uses: actions/setup-python@v5 with: - python-version: 3.11 - - run: pip install pipenv pylint flake8 - - run: pipenv sync && pipenv run pylint **/*.py - # - run: flake8 + python-version: '3.11' + + - run: python -m pip install pipenv pylint + + # TODO: Fix the linting issue... + # - run: pipenv run pylint **/*.py + + hadolint: + name: Hadolint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + - uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: Dockerfile + + shellcheck: + name: ShellCheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master + + docker: + name: Docker build smoke test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + # TODO: Use this when ready to push + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: false + tags: zerodaysec/${{ env.SVC_NAME }}:testing \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ec26919 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.11 + +WORKDIR /app + +# TODO: Need to enable pipenv +# COPY requirements.txt /app/ +COPY app.py /app/ + +ENV FLASK_APP=app.py + +ENTRYPOINT ["flask", "run"] \ No newline at end of file