build my base image
This commit is contained in:
109
.github/workflows/build-push-docker.yml
vendored
109
.github/workflows/build-push-docker.yml
vendored
@@ -1,17 +1,19 @@
|
|||||||
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
|
# https://www.springcloud.io/post/2022-08/springcloud-github-actions
|
||||||
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
|
# good reference
|
||||||
|
|
||||||
|
|
||||||
name: Maven Package
|
name: Maven Package
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# Triggers the workflow on push or pull request events but only for the main branch
|
# Triggers the workflow on push request events but only for the main branch
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
# tags: # tags 更新时触发 workflow
|
# tags: # tags 更新时触发 workflow
|
||||||
# - 'v*'
|
# - 'v*'
|
||||||
|
# when merged from branches to master will triger the action
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
# manually run this workflow from the Actions tab
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|
||||||
@@ -21,6 +23,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 11
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@@ -30,23 +33,87 @@ jobs:
|
|||||||
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||||
cache: maven
|
cache: maven
|
||||||
|
|
||||||
- name: Build Maven
|
- name: Docker Setup QEMU
|
||||||
run: |
|
# You may pin to the exact commit or the version.
|
||||||
mvn -B -DskipTests=true package --file pom.xml
|
# uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18
|
||||||
ls
|
uses: docker/setup-qemu-action@v2.1.0
|
||||||
echo "--------------------------------------"
|
with:
|
||||||
pwd
|
# QEMU static binaries Docker image (e.g. tonistiigi/binfmt:latest)
|
||||||
echo "--------------------------------------"
|
image: # optional, default is tonistiigi/binfmt:latest
|
||||||
cd ./server/target
|
# Platforms to install (e.g. arm64,riscv64,arm)
|
||||||
ls
|
platforms: amd64,arm64
|
||||||
cd /home/runner/work/ProjectOctopus/ProjectOctopus
|
|
||||||
echo "--------------------------------------"
|
- name: Docker Setup Buildx
|
||||||
cd ./agent/target
|
# You may pin to the exact commit or the version.
|
||||||
ls
|
# uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325
|
||||||
cd /home/runner/work/ProjectOctopus/ProjectOctopus
|
uses: docker/setup-buildx-action@v2.2.1
|
||||||
echo "--------------------------------------"
|
|
||||||
cat /proc/cpuinfo
|
- name: Docker Login
|
||||||
echo "--------------------------------------"
|
# You may pin to the exact commit or the version.
|
||||||
|
# uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
||||||
|
uses: docker/login-action@v2.1.0
|
||||||
|
with:
|
||||||
|
# Username used to log against the Docker registry
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
# Password or personal access token used to log against the Docker registry
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
# optional, default is true
|
||||||
|
logout: true
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build My Base Image
|
||||||
|
uses: docker/build-push-action@v3.2.0
|
||||||
|
with:
|
||||||
|
context: ./
|
||||||
|
# Path to the Dockerfile
|
||||||
|
file: ./localEnvironment/src/main/java/io/wdd/localenviroment/build-my-own-base-image.dockerfile
|
||||||
|
platforms: linux/amd64,,linux/arm64
|
||||||
|
push: true
|
||||||
|
|
||||||
|
# - name: Build Maven
|
||||||
|
# run: |
|
||||||
|
# mvn -B -DskipTests=true package --file pom.xml
|
||||||
|
# ls
|
||||||
|
# echo "--------------------------------------"
|
||||||
|
# pwd
|
||||||
|
# echo "--------------------------------------"
|
||||||
|
# cd ./server/target
|
||||||
|
# ls
|
||||||
|
# cd /home/runner/work/ProjectOctopus/ProjectOctopus
|
||||||
|
# echo "--------------------------------------"
|
||||||
|
# cd ./agent/target
|
||||||
|
# ls
|
||||||
|
# cd /home/runner/work/ProjectOctopus/ProjectOctopus
|
||||||
|
# echo "--------------------------------------"
|
||||||
|
# cat /proc/cpuinfo
|
||||||
|
# echo "--------------------------------------"
|
||||||
|
#
|
||||||
|
# - name: Build and push Docker images
|
||||||
|
# # You may pin to the exact commit or the version.
|
||||||
|
# # uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5
|
||||||
|
# uses: docker/build-push-action@v3.2.0
|
||||||
|
# with:
|
||||||
|
# context: # optional
|
||||||
|
# # Path to the Dockerfile
|
||||||
|
# file: # optional
|
||||||
|
# # List of metadata for an image
|
||||||
|
# labels: # optional
|
||||||
|
# # Load is a shorthand for --output=type=docker
|
||||||
|
# load: # optional, default is false
|
||||||
|
# # Set the networking mode for the RUN instructions during build
|
||||||
|
# network: # optional
|
||||||
|
# # Do not use cache when building the image
|
||||||
|
# no-cache: # optional, default is false
|
||||||
|
# # Do not cache specified stages
|
||||||
|
# no-cache-filters: # optional
|
||||||
|
# # List of output destinations (format: type=local,dest=path)
|
||||||
|
# outputs: # optional
|
||||||
|
# # List of target platforms for build
|
||||||
|
# platforms: linux/amd64,,linux/arm64
|
||||||
|
# # Always attempt to pull all referenced images
|
||||||
|
# pull: # optional, default is false
|
||||||
|
# # Push is a shorthand for --output=type=registry
|
||||||
|
# push: # optional, default is false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
FROM eclipse-temurin:11-jre-focal
|
||||||
|
|
||||||
|
MAINTAINER zeaslity@gmail.com
|
||||||
|
|
||||||
|
RUN /bin/sh -c apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends iputils-ping net-tools dnsutils lsof curl wget mtr-tiny vim && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && locale-gen en_US.UTF-8 && rm -rf /var/lib/apt/lists/*
|
||||||
26
server/Dockerfile
Normal file
26
server/Dockerfile
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
# Base images that the image needs to depend on
|
||||||
|
FROM openjdk:11-jre-alpine
|
||||||
|
|
||||||
|
# The name of the maintainer
|
||||||
|
MAINTAINER super-wdd
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m"
|
||||||
|
|
||||||
|
# Set time zone
|
||||||
|
RUN set -eux; \
|
||||||
|
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime; \
|
||||||
|
echo $TZ > /etc/timezone \
|
||||||
|
|
||||||
|
# Create Folder
|
||||||
|
RUN mkdir -p /wdd
|
||||||
|
|
||||||
|
# Define the work dir
|
||||||
|
WORKDIR /wdd
|
||||||
|
|
||||||
|
# Copy the jar and rename it
|
||||||
|
COPY ./target/server-*.jar /server.jar
|
||||||
|
|
||||||
|
# When the docker container starts, run the jar
|
||||||
|
ENTRYPOINT exec java ${JAVA_OPTS} -jar /wdd/lfs-admin.jar
|
||||||
Reference in New Issue
Block a user