Skip to content

Commit

Permalink
Create Dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
  • Loading branch information
glimchb committed Feb 16, 2023
1 parent e3bda9d commit 02d3e90
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @opiproject/opi-maintainers
60 changes: 60 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
name: Docker

on:
workflow_dispatch:
workflow_call:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2.4.1

- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Log in to the GH Container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4.3.0
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4.0.0
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
31 changes: 31 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Linters

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
markdown-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run tests
run: docker run -v $PWD:/workdir ghcr.io/igorshubovych/markdownlint-cli:latest --ignore=minutes --disable=MD013 "**/*.md"

docker-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hadolint/hadolint-action@v3.1.0
with:
recursive: true
ignore: DL3008

shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: azohra/shell-linter@v0.6.0
11 changes: 11 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Release

on:
workflow_dispatch:
release:
types: [published]

jobs:
release-docker:
uses: ./.github/workflows/docker-publish.yml
secrets: inherit
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2022 Dell Inc, or its subsidiaries.

FROM docker.io/library/python:3.10.8-slim

RUN apt-get update && apt-get install -y --no-install-recommends gettext libsqlite3-dev curl gcc && rm -rf /var/lib/apt/lists/*

COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir --requirement /tmp/requirements.txt

ENTRYPOINT ["sztpd"]
CMD ["sqlite:///:memory:"]
HEALTHCHECK CMD curl --fail -H Accept:application/yang-data+json http://127.0.0.1:8080/.well-known/host-meta || exit 1
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Secure Zero Touch Provisioning (sZTP)

[![Linters](https://github.com/opiproject/sztpd/actions/workflows/linters.yml/badge.svg)](https://github.com/opiproject/sztpd/actions/workflows/linters.yml)
[![Docker](https://github.com/opiproject/sztpd/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/opiproject/sztpd/actions/workflows/docker-publish.yml)
[![License](https://img.shields.io/github/license/opiproject/sztpd?style=flat-square&color=blue&label=License)](https://github.com/opiproject/sztpd/blob/master/LICENSE)
[![Pulls](https://img.shields.io/docker/pulls/opiproject/sztpd.svg?logo=docker&style=flat&label=Pulls)](https://hub.docker.com/r/opiproject/sztpd)
[![Last Release](https://img.shields.io/github/v/release/opiproject/sztpd?label=Latest&style=flat-square&logo=go)](https://github.com/opiproject/sztpd/releases)

This project contains Dockerfile for <https://pypi.org/project/sztpd>

## I Want To Contribute

This project welcomes contributions and suggestions. We are happy to have the Community involved via submission of **Issues and Pull Requests** (with substantive content or even just fixes). We are hoping for the documents, test framework, etc. to become a community process with active engagement. PRs can be reviewed by by any number of people, and a maintainer may accept.

See [CONTRIBUTING](https://github.com/opiproject/opi/blob/main/CONTRIBUTING.md) and [GitHub Basic Process](https://github.com/opiproject/opi/blob/main/doc-github-rules.md) for more details.

## Installation

There are several ways of running sztpd.

### Docker

```sh
docker pull opiproject/sztpd:<version>
```

You can specify a version like `0.0.11` or use `latest` to get the most up-to-date version.

```sh
docker run --rm -e SZTPD_INIT_MODE=1 -e SZTPD_ACCEPT_CONTRACT=Yes -e SZTPD_INIT_PORT=8080 -e SZTPD_INIT_ADDR=127.0.0.1 opiproject/sztpd:<version>
```

### PyPI

```sh
pip install sztpd==0.0.11
```
6 changes: 6 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
]
}
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sqlalchemy<2.0.0
sztpd==0.0.11

0 comments on commit 02d3e90

Please sign in to comment.