Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to tow-step build #100

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .github/workflows/build-latest-images.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Build latest images manually
name: Build latest images automatically

on:
workflow_dispatch: {}
push:
branches:
- main

jobs:
deploy:
strategy:
fail-fast: false
matrix:
latest-version: ["0.0.2"]
fail-fast: true

runs-on: ubuntu-latest

Expand All @@ -29,14 +29,13 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push release
id: docker_build_release
name: Build and push
id: docker_build_latest
uses: docker/build-push-action@v4
with:
context: .
build-args: |
BCC_VERSION=v0.28.0
DUETECTOR_VERSION=${{ matrix.latest-version }}
platforms: linux/amd64,linux/arm64/v8
file: ./docker/Dockerfile
push: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
name: Build images manually
name: Testing docker image build

on:
workflow_dispatch: {}
pull_request:
branches: [ "master", "main" ]

jobs:
deploy:
strategy:
fail-fast: false
matrix:
duetector-version: ["0.0.1", "0.0.2"]
fail-fast: true

runs-on: ubuntu-latest

Expand All @@ -29,15 +28,14 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push image
id: docker_build
name: Build image
id: docker_build_test
uses: docker/build-push-action@v4
with:
context: .
build-args: |
BCC_VERSION=v0.28.0
DUETECTOR_VERSION=${{ matrix.duetector-version }}
platforms: linux/amd64,linux/arm64/v8
file: ./docker/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/duetector:${{ matrix.duetector-version }}
push: false
tags: build
41 changes: 41 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release docker image

on:
workflow_dispatch: {}
release:
types: [published]

permissions:
contents: write

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build_release
uses: docker/build-push-action@v4
with:
context: .
build-args: |
BCC_VERSION=v0.28.0
platforms: linux/amd64,linux/arm64/v8
file: ./docker/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/duetector:${{ github.ref_name }}
81 changes: 0 additions & 81 deletions .github/workflows/publish.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python package
name: Testing python package

on:
push:
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: write

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine hatch
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Upload dists to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*
file_glob: true
tag: ${{ github.ref }}
overwrite: true
17 changes: 11 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
ARG BCC_VERSION=v0.28.0

FROM dataucon/ubuntu-bcc:${BCC_VERSION}
FROM python:3.10.12-slim-bookworm as builder

RUN pip install build twine hatch
COPY . /source
WORKDIR /source
RUN python -m build

ARG DUETECTOR_VERSION
FROM dataucon/ubuntu-bcc:${BCC_VERSION}

RUN apt-get update && apt-get install -y tini \
&& rm -rf /var/lib/apt/lists/*
RUN pip install jupyterlab

RUN pip install duetector==${DUETECTOR_VERSION} --no-cache-dir

COPY --from=builder /source/dist/*.whl /tmp/
RUN pip install /tmp/*.whl --no-cache-dir

# Add application user

ARG APPLICATION_UID=9999
ARG APPLICATION_GID=9999
RUN addgroup --system --gid ${APPLICATION_GID} application && \
adduser --system --gid ${APPLICATION_GID} --home /home/application --uid ${APPLICATION_UID} --disabled-password application && \
usermod -s /bin/bash application
# Install Jupyterlab as example application
RUN pip install jupyterlab --no-cache-dir

COPY docker/start.sh /start.sh
RUN chmod +x /start.sh
Expand Down
32 changes: 0 additions & 32 deletions docker/Dockerfile.dev

This file was deleted.