Skip to content

Commit

Permalink
add python base and ubuntu base image
Browse files Browse the repository at this point in the history
  • Loading branch information
gakaki committed Feb 6, 2024
1 parent 4ce8545 commit 5e79419
Show file tree
Hide file tree
Showing 13 changed files with 379 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ target
Cargo.lock
.idea
target
*.csv
*.csv
/spring-data-examples
102 changes: 102 additions & 0 deletions backend_java/.github/workflows/frontend_spa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# https://developer.okta.com/blog/2022/04/22/github-actions-graalvm
name: Native CI
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
permissions:
contents: read
jobs:
pipeline:
name: flickr2 native pipeline
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.pull_request.title, '[skip ci]') && !contains(github.event.pull_request.title, '[ci skip]')"
timeout-minutes: 90
env:
SPRING_OUTPUT_ANSI_ENABLED: DETECT
SPRING_JPA_SHOW_SQL: false
JHI_DISABLE_WEBPACK_LOGS: true
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-2019]
graalvm-version: ['22.0.0.2']
java-version: ['11']
include:
- os: ubuntu-latest
executable-suffix: ''
native-build-args: --verbose -J-Xmx10g
- os: macos-latest
executable-suffix: ''
native-build-args: --verbose -J-Xmx13g
- os: windows-2019
executable-suffix: '.exe'
# e2e is disabled due to unstable docker step
e2e: false
native-build-args: --verbose -J-Xmx10g
steps:
# OS customizations that allow the builds to succeed on Linux and Windows.
# Using hash for better security due to third party actions.
- name: Set up swap space
if: runner.os == 'Linux'
# v1.0 (49819abfb41bd9b44fb781159c033dba90353a7c)
uses: pierotofy/set-swap-space@49819abfb41bd9b44fb781159c033dba90353a7c
with:
swap-size-gb: 10
- name:
Configure pagefile
# v1.2 (7e234852c937eea04d6ee627c599fb24a5bfffee)
uses: al-cheb/configure-pagefile-action@7e234852c937eea04d6ee627c599fb24a5bfffee
if: runner.os == 'Windows'
with:
minimum-size: 10GB
maximum-size: 12GB
- name: Set up pagefile
if: runner.os == 'Windows'
run: |
(Get-CimInstance Win32_PageFileUsage).AllocatedBaseSize
shell: pwsh
- name: 'SETUP: docker'
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install --cask docker
sudo /Applications/Docker.app/Contents/MacOS/Docker --unattended --install-privileged-components
open -a /Applications/Docker.app --args --unattended --accept-license
#echo "We are waiting for Docker to be up and running. It can take over 2 minutes..."
#while ! /Applications/Docker.app/Contents/Resources/bin/docker info &>/dev/null; do sleep 1; done
if: runner.os == 'macOS'

- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.14.0
- name: Set up GraalVM (Java ${{ matrix.java-version }})
uses: graalvm/setup-graalvm@v1
with:
version: '${{ matrix.graalvm-version }}'
java-version: '${{ matrix.java-version }}'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Maven dependencies
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven
- name: Cache npm dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
- name: Install node.js packages
run: npm install
- name: 'E2E: Package'
run: npm run native-package -- -B -ntp "-Dnative-build-args=${{ matrix.native-build-args }}"
- name: 'E2E: Prepare'
if: matrix.e2e != false
run: npm run ci:e2e:prepare
- name: 'E2E: Run'
if: matrix.e2e != false
run: npm run native-e2e
33 changes: 33 additions & 0 deletions backend_java/.github/workflows/golang_cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# on: [push]
# name: test-docker

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile_Github
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/rust_template:latest
33 changes: 33 additions & 0 deletions backend_java/.github/workflows/java.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# https://github.com/marketplace/actions/github-action-for-graalvm
name: GraalVM Native Image builds
on: [push, pull_request]
jobs:
build:
name: FoodTrucksBackend on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Step Show Envs
run: |
echo "GRAALVM_HOME: $GRAALVM_HOME"
echo "JAVA_HOME: $JAVA_HOME"
java --version
native-image --version
- name: Example step using Maven plugin # https://graalvm.github.io/native-build-tools/latest/maven-plugin.html
run: mvn -Pnative package
# - name: Example step using Gradle plugin # https://graalvm.github.io/native-build-tools/latest/gradle-plugin.html
# run: gradlew nativeCompile
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: foodTruck-${{ matrix.os }}
path: foodTruck*
33 changes: 33 additions & 0 deletions backend_java/.github/workflows/rust_cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# on: [push]
# name: test-docker

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

jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile_Github
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/rust_template:latest
5 changes: 4 additions & 1 deletion backend_java/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ build/
### VS Code ###
.vscode/
target
meilisearch-react-demo
meilisearch-react-demo


todo.md
27 changes: 27 additions & 0 deletions backend_java/DockerfilePythonBase
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM gakaki/base

RUN apt-get install -y wget bzip2
RUN wget https://repo.anaconda.com/archive/Anaconda3-2023.09-0-Linux-x86_64.sh
RUN bash Anaconda3-2023.09-0-Linux-x86_64.sh -b
RUN rm Anaconda3-5.0.1-Linux-x86_64.sh
ENV PATH /root/anaconda3/bin:$PATH

RUN conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/ \
&& conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/ \
&& conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/ \
&& conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/ \
&& conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/ \
&& conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/ \
&& conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/

RUN conda update conda
RUN conda update anaconda
RUN conda update --all

RUN mkdir /opt/notebooks
RUN jupyter notebook --generate-config --allow-root
RUN echo "c.NotebookApp.password = u'sha1:6a3f528eec40:6e896b6e4828f525a6e20e5411cd1c8075d68619'" >> /root/.jupyter/jupyter_notebook_config.py

EXPOSE 8888

CMD ["jupyter", "notebook", "--allow-root", "--notebook-dir=/opt/notebooks", "--ip='*'", "--port=8888", "--no-browser"]
44 changes: 44 additions & 0 deletions backend_java/DockerfileUbuntuBase
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM ubuntu:latest
# ubuntu 安装 php 依赖
# ubuntu 安装 python 依赖
# Docker 时区调整方案

RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \
&& sed -i 's/cn.archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \
&& sed -i 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \
&& sed -i 's/ports.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list

## locales
RUN apt-get update -y && apt upgrade -y && apt-get dist-upgrade -y && apt-get install -y tzdata locales && rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8
# Docker 时区调整方案
## timezone
ENV TZ=Asia/Shanghai \
DEBIAN_FRONTEND=noninteractive

RUN apt-get install -y tzdata \
&& ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update -y && apt-get install -y build-essential \
automake git make bison flex gcc patch autoconf subversion locate vim \
libncursesw5-dev libgdbm-dev libc6-dev \
libsqlite3-dev tk-dev \
libssl-dev openssl libcurl4-openssl-dev \
libffi-dev \
libxpm-dev libxext-dev \
zlib1g-dev libbz2-dev libssl-dev libncurses5-dev libsqlite3-dev \
libreadline-dev tk-dev libgdbm-dev libdb-dev libpcap-dev xz-utils libexpat1-dev \
liblzma-dev libffi-dev libc6-dev \
libxml2-dev libpcre3-dev \
libjpeg-dev libpng-dev libmhash-dev libmhash2 \
libmcrypt-dev libxslt1-dev \
libpq-dev libpq5 \
libglib2.0-0
# glib2.0 not find in current ubunt docer latest
CMD ["/bin/bash"]


20 changes: 17 additions & 3 deletions backend_java/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
##
redission 配置
redisson常用配置
## Docker-Compose 使用
### 设置 mac orbstack docker hub镜像加速
来自[阿里云](https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors)
{
"registry-mirrors": ["https://xi1udf2u.mirror.aliyuncs.com"]
}
###
docker-compose up -d


## GitHub Action for GraalVM and Maven Dependencies Cache




## Redis库 Redission 配置

https://github.com/redisson/redisson/wiki/2.-%E9%85%8D%E7%BD%AE%E6%96%B9%E6%B3%95#23-%E5%B8%B8%E7%94%A8%E8%AE%BE%E7%BD%AE

## csv show
Expand Down
44 changes: 43 additions & 1 deletion backend_java/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,58 @@
# https://docs.docker.com/compose/compose-file/compose-file-v3/
# docker-compose build --no-cache --progress=plain app
services:
# base:
# platform: linux/x86_64
# image: gakaki/base
## restart: on-failure
# container_name: base
# environment:
# TZ: Asia/Shanghai
# build:
# context: .
# dockerfile: DockerfileUbuntuBase
# args:
# progress: plain
## entrypoint: [ "/bin/sh","-c" ]
# tty: true
# stdin_open: true
## command:
## - |
## echo a
## echo b
## echo c
#
## docker-compose build --no-cache base
## docker-compose up -d base
## docker-compose exec base bash
#
# python:
# platform: linux/x86_64
# image: gakaki/python
# container_name: python
# build:
# context: .
# dockerfile: DockerfilePythonBase
# args:
# progress: plain
# tty: true
# stdin_open: true

qdrant:
image: qdrant/qdrant:v1.3.0
restart: on-failure
ports:
- "6333:6333"
- "6334:6334"
-

baseimage:
platform: linux/x86_64
build:
context: .
dockerfile: DockerfileBellSoftGraalVM
args:
progress: plain

image: baseimage:0.0.1

app:
Expand Down
Loading

0 comments on commit 5e79419

Please sign in to comment.