Skip to content

Commit

Permalink
👷 update docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
jxnkwlp committed Apr 26, 2023
1 parent 83ac99a commit 24bd04c
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 99 deletions.
142 changes: 142 additions & 0 deletions .github/workflows/build-pack.yml
@@ -0,0 +1,142 @@
name: build and pack

on:
push:
branches: [main, develop]
#pull_request:
# branches: [main, develop]
workflow_dispatch:
inputs:
# logLevel:
# description: "Log level"
# required: true
# default: "warning"
# type: choice
# options:
# - info
# - warning
# - debug
push_nuget:
description: "Push nuget packages"
required: true
type: boolean
default: true
push_docker:
description: "Push docker images"
required: true
type: boolean
default: true
push_release:
description: "Create release"
required: true
type: boolean
default: true

env:
PUSH_DOCKER: ${{ inputs.push_docker || 'true' }}
PUSH_NUGET: ${{ inputs.push_docker || 'true' }}
PUSH_RELEASE: ${{ inputs.push_release || 'true' }}

jobs:
build:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/cache@v3
with:
path: ${{github.workspace}}/src/Passingwind.ElsaDesigner/node_modules
key: ${{ runner.os }}-yarn-cache
restore-keys: |
${{ runner.os }}-node
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
- name: Install dotnet tool
run: dotnet tool install -g Passingwind.Git-CI-Tools

- name: Set environment vars
uses: rlespinasse/github-slug-action@3.6.0

- name: Version check and generate
run: |
gitci release changes --output ./changeslog.md
gitci version next --format json --output ./version.json --build-ver "${{env.GITHUB_SHA_SHORT}}"
ls ./
- id: changes
uses: dorny/paths-filter@v2
with:
filters: |
src:
- 'src/**'
- name: DotNet restore dependencies
run: dotnet restore Passingwind.WorkflowApp.sln

- name: DotNet build
run: dotnet build --no-restore -c Release Passingwind.WorkflowApp.sln

- name: DotNet pack
# if: steps.changes.outputs.src == 'true'
run: dotnet pack --no-build --no-restore -c Release /p:Version="${{env.GITCI_NEXT_VERSION}}" --property:PackageOutputPath=${{github.workspace}}/pack_output Passingwind.Abp.ElsaModule.sln

- name: DotNet app publish
# if: steps.changes.outputs.src == 'true'
run: dotnet publish ./app/src/Passingwind.WorkflowApp.Web/Passingwind.WorkflowApp.Web.csproj --output ${{github.workspace}}/docker/app -c Release /p:Version="${{env.GITCI_NEXT_VERSION}}"

- uses: actions/setup-node@v3
with:
node-version: "16"

- name: node yarn
run: |
cd ./src/Passingwind.ElsaDesigner
yarn
- name: npm build
run: |
cd ./src/Passingwind.ElsaDesigner
npm run build
- name: zip node assets
#if: steps.changes.outputs.src == 'true'
run: |
cd ${{github.workspace}}/src/Passingwind.ElsaDesigner
zip ${{github.workspace}}/pack_output/workflow-dashboard.zip -r ./dist/*
- name: Docker
#if: steps.changes.outputs.src == 'true'
if: ${{ env.PUSH_DOCKER == 'true' }}
run: |
# copy
rm -rf ${{github.workspace}}/docker/app/wwwroot/dist/
cp -r ${{github.workspace}}/src/Passingwind.ElsaDesigner/dist ${{github.workspace}}/docker/app/wwwroot/
#
docker login -u ${{vars.DOCKER_USER_NAME}} -p ${{secrets.DOCKER_USER_AK}}
docker build -t ${{vars.DOCKER_IMAGE_NAME}}:${{env.GITCI_NEXT_VERSION}} .
docker push ${{vars.DOCKER_IMAGE_NAME}}:${{env.GITCI_NEXT_VERSION}}
- name: Push dotnet package
#if: steps.changes.outputs.src == 'true'
if: ${{ env.PUSH_RELEASE == 'true' }}
run: dotnet nuget push ./pack_output/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json

- name: Create Release
#if: steps.changes.outputs.src == 'true'
uses: ncipollo/release-action@v1
if: ${{ env.PUSH_DOCKER == 'true' }}
with:
tag: v${{env.GITCI_NEXT_VERSION}}
artifacts: ./changeslog*, ./pack_output/*
bodyFile: ./changeslog.md
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
94 changes: 0 additions & 94 deletions .github/workflows/build.yml

This file was deleted.

8 changes: 5 additions & 3 deletions devops/Dockerfile → docker/Dockerfile
@@ -1,13 +1,15 @@
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine

EXPOSE 80

#
WORKDIR /app

ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false

RUN apk add --no-cache icu-libs icu-data-full krb5-libs libgcc libintl libssl1.1 libstdc++ zlib tzdata

#
COPY app /app

ENTRYPOINT ["dotnet", "Passingwind.WorkflowApp.Web.dll"]
ENTRYPOINT ["dotnet", "Passingwind.WorkflowApp.Web.dll"]
1 change: 1 addition & 0 deletions docker/README.md
@@ -0,0 +1 @@
# ABP & Elsa Application
File renamed without changes.
3 changes: 1 addition & 2 deletions devops/docker-compose.yml → docker/docker-compose.yml
Expand Up @@ -3,12 +3,11 @@ version: '3.8'
services:
app:
build: .
# image: backend:latest
ports:
- 10000:80
restart: always
environment:
- TZ=Asia/Shanghai
volumes:
# - ./appsettings.json:/app/appsettings.Production.json
- ./appsettings.json:/app/appsettings.json
#

0 comments on commit 24bd04c

Please sign in to comment.