Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit cd3f4a7

Browse files
authored
Merge pull request #225 from green-ecolution/release/v1.0.0
Release v1.0.0
2 parents c0b0e1d + 30f1be6 commit cd3f4a7

File tree

216 files changed

+13886
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+13886
-0
lines changed

.docker/Dockerfile.dev

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#############################################
2+
# Builder web
3+
#############################################
4+
FROM openapitools/openapi-generator-cli AS openapi-builder
5+
6+
USER root
7+
RUN echo "java -jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar \$@" > /usr/local/bin/openapi-generator-cli \
8+
&& chmod +x /usr/local/bin/openapi-generator-cli
9+
10+
WORKDIR /app
11+
12+
COPY ./backend-client/api-docs.json ./backend-client/openapi-generator.sh ./
13+
14+
RUN ./openapi-generator.sh local
15+
16+
#############################################
17+
# Builder web
18+
#############################################
19+
FROM node:20-alpine AS builder-web
20+
21+
ENV VITE_BACKEND_BASEURL=/api
22+
WORKDIR /app/build
23+
COPY ./backend-client/package.json ./backend-client/
24+
COPY ./frontend/package.json ./frontend/
25+
COPY ./yarn.lock ./package.json ./
26+
RUN yarn --frozen-lockfile
27+
28+
COPY ./backend-client/tsconfig.json ./backend-client/
29+
COPY --from=openapi-builder /app/src ./backend-client/src
30+
RUN yarn build:backend-client
31+
32+
COPY ./frontend ./frontend
33+
RUN yarn build:frontend:dev
34+
35+
#############################################
36+
# Nginx
37+
#############################################
38+
FROM nginx:latest
39+
RUN rm /etc/nginx/conf.d/default.conf
40+
COPY .docker/nginx.conf /etc/nginx/conf.d/
41+
COPY --from=builder-web /app/build/frontend/dist /usr/share/nginx/html
42+
43+
EXPOSE 80
44+
45+
CMD ["nginx", "-g", "daemon off;"]
46+

.docker/Dockerfile.prod

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#############################################
2+
# Builder web
3+
#############################################
4+
FROM openapitools/openapi-generator-cli AS openapi-builder
5+
6+
USER root
7+
RUN echo "java -jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar \$@" > /usr/local/bin/openapi-generator-cli \
8+
&& chmod +x /usr/local/bin/openapi-generator-cli
9+
10+
WORKDIR /app
11+
12+
COPY ./backend-client/api-docs.json ./backend-client/openapi-generator.sh ./
13+
14+
RUN ./openapi-generator.sh local
15+
16+
#############################################
17+
# Builder web
18+
#############################################
19+
FROM node:20-alpine AS builder-web
20+
21+
ENV VITE_BACKEND_BASEURL=/api
22+
WORKDIR /app/build
23+
COPY ./backend-client/package.json ./backend-client/
24+
COPY ./frontend/package.json ./frontend/
25+
COPY ./yarn.lock ./package.json ./
26+
RUN yarn --frozen-lockfile
27+
28+
COPY ./backend-client/tsconfig.json ./backend-client/
29+
COPY --from=openapi-builder /app/src ./backend-client/src
30+
RUN yarn build:backend-client
31+
32+
COPY ./frontend ./frontend
33+
RUN yarn build:frontend
34+
35+
#############################################
36+
# Nginx
37+
#############################################
38+
FROM nginx:latest
39+
RUN rm /etc/nginx/conf.d/default.conf
40+
COPY .docker/nginx.conf /etc/nginx/conf.d/
41+
COPY --from=builder-web /app/build/frontend/dist /usr/share/nginx/html
42+
43+
EXPOSE 80
44+
45+
CMD ["nginx", "-g", "daemon off;"]
46+

.docker/Dockerfile.stage

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#############################################
2+
# Builder web
3+
#############################################
4+
FROM openapitools/openapi-generator-cli AS openapi-builder
5+
6+
USER root
7+
RUN echo "java -jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar \$@" > /usr/local/bin/openapi-generator-cli \
8+
&& chmod +x /usr/local/bin/openapi-generator-cli
9+
10+
WORKDIR /app
11+
12+
COPY ./backend-client/api-docs.json ./backend-client/openapi-generator.sh ./
13+
14+
RUN ./openapi-generator.sh local
15+
16+
#############################################
17+
# Builder web
18+
#############################################
19+
FROM node:20-alpine AS builder-web
20+
21+
ENV VITE_BACKEND_BASEURL=/api
22+
WORKDIR /app/build
23+
COPY ./backend-client/package.json ./backend-client/
24+
COPY ./frontend/package.json ./frontend/
25+
COPY ./yarn.lock ./package.json ./
26+
RUN yarn --frozen-lockfile
27+
28+
COPY ./backend-client/tsconfig.json ./backend-client/
29+
COPY --from=openapi-builder /app/src ./backend-client/src
30+
RUN yarn build:backend-client
31+
32+
COPY ./frontend ./frontend
33+
RUN yarn build:frontend:stage
34+
35+
#############################################
36+
# Nginx
37+
#############################################
38+
FROM nginx:latest
39+
RUN rm /etc/nginx/conf.d/default.conf
40+
COPY .docker/nginx.conf /etc/nginx/conf.d/
41+
COPY --from=builder-web /app/build/frontend/dist /usr/share/nginx/html
42+
43+
EXPOSE 80
44+
45+
CMD ["nginx", "-g", "daemon off;"]
46+

.docker/nginx.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
server {
2+
listen 80;
3+
listen [::]:80;
4+
5+
location / {
6+
root /usr/share/nginx/html;
7+
try_files $uri $uri/ /index.html;
8+
}
9+
}

.dockerignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
25+
26+
backend-client/**
27+
!backend-client/openapi-generator.sh
28+
!backend-client/api-docs.json
29+
!backend-client/package.json
30+
!backend-client/tsconfig.json

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[*.{ts,tsx,json}]
2+
indent_style = space
3+
indent_size = 2
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Build and Push Docker Image Develop
2+
"on":
3+
push:
4+
branches:
5+
- develop
6+
7+
jobs:
8+
build_and_deploy_dev:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
packages: write
13+
actions: write
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
submodules: true
19+
20+
- name: Set commit sha
21+
run: |
22+
echo "COMMIT_SHA=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_ENV
23+
24+
- name: Set up QEMU
25+
uses: docker/setup-qemu-action@v3
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v3
29+
30+
- name: Login to Container Registry
31+
uses: docker/login-action@v3
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: set lower case owner name
38+
run: |
39+
echo "REPO_LC=${REPO,,}" >>${GITHUB_ENV}
40+
env:
41+
REPO: "${{ github.repository }}"
42+
43+
- name: get build time
44+
run: |
45+
echo "BUILD_TIME=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >>${GITHUB_ENV}
46+
47+
- name: Get api docs artifacts
48+
env:
49+
GH_TOKEN: ${{ secrets.GREEN_ECOLUTION_PAT }}
50+
run: |
51+
gh run download -R green-ecolution/green-ecolution-backend -n api-docs.json
52+
mv api-docs.json ./backend-client/api-docs.json
53+
54+
- name: Build and push
55+
uses: docker/build-push-action@v5
56+
with:
57+
context: .
58+
build-args: |
59+
APP_VERSION="development"
60+
APP_GIT_COMMIT=${{env.COMMIT_SHA}}
61+
APP_GIT_BRANCH="develop"
62+
APP_BUILD_TIME=${{env.BUILD_TIME}}
63+
APP_GIT_REPOSITORY=${{github.repository}}
64+
file: ./.docker/Dockerfile.dev
65+
platforms: linux/amd64 #,linux/arm64
66+
push: true
67+
tags: ghcr.io/${{ env.REPO_LC }}-dev:latest, ghcr.io/${{ env.REPO_LC }}-dev:${{ env.COMMIT_SHA }}
68+
69+
- name: Notify management repo to update submodules
70+
uses: peter-evans/repository-dispatch@v3
71+
with:
72+
token: ${{ secrets.GREEN_ECOLUTION_PAT }}
73+
repository: green-ecolution/green-ecolution-management
74+
event-type: "update-submodules"
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Build and Push Docker Image Production
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types:
8+
- closed
9+
10+
jobs:
11+
build_and_deploy_prod:
12+
runs-on: ubuntu-latest
13+
if: github.event.pull_request.merged == true &&
14+
(startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix/'))
15+
permissions:
16+
contents: write
17+
packages: write
18+
actions: write
19+
pull-requests: write
20+
steps:
21+
- name: Extract version from branch name (for release branches)
22+
if: startsWith(github.event.pull_request.head.ref, 'release/')
23+
run: |
24+
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
25+
VERSION=${BRANCH_NAME#release/}
26+
27+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
28+
29+
- name: Extract version from branch name (for hotfix branches)
30+
if: startsWith(github.event.pull_request.head.ref, 'hotfix/')
31+
run: |
32+
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
33+
VERSION=${BRANCH_NAME#hotfix/}
34+
35+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
36+
37+
- name: Create Release
38+
uses: thomaseizinger/create-release@1.0.0
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
with:
42+
target_commitish: ${{ github.event.pull_request.merge_commit_sha }}
43+
tag_name: ${{ env.RELEASE_VERSION }}
44+
name: ${{ env.RELEASE_VERSION }}
45+
draft: false
46+
prerelease: false
47+
48+
- name: Merge main into develop branch
49+
uses: thomaseizinger/create-pull-request@1.0.0
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
with:
53+
head: main
54+
base: develop
55+
title: Merge main into develop branch
56+
body: |
57+
This PR merges the main branch back into develop.
58+
This happens to ensure that the updates that happend on the release branch, i.e. CHANGELOG and manifest updates are also present on the develop branch.
59+
60+
- name: Checkout code
61+
uses: actions/checkout@v4
62+
with:
63+
submodules: true
64+
65+
- name: Set up Docker Buildx
66+
uses: docker/setup-buildx-action@v3
67+
68+
- name: Login to Container Registry
69+
uses: docker/login-action@v3
70+
with:
71+
registry: ghcr.io
72+
username: ${{ github.actor }}
73+
password: ${{ secrets.GITHUB_TOKEN }}
74+
75+
- name: set lower case owner name
76+
run: |
77+
echo "REPO_LC=${REPO,,}" >>${GITHUB_ENV}
78+
env:
79+
REPO: "${{ github.repository }}"
80+
81+
- name: get build time
82+
run: |
83+
echo "BUILD_TIME=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >>${GITHUB_ENV}
84+
85+
- name: Get api docs artifacts
86+
env:
87+
GH_TOKEN: ${{ secrets.GREEN_ECOLUTION_PAT }}
88+
run: |
89+
gh run download -R green-ecolution/green-ecolution-backend -n api-docs-${{ env.RELEASE_VERSION }}.json
90+
mv api-docs-${{ env.RELEASE_VERSION }}.json ./backend-client/api-docs.json
91+
92+
- name: Build and push
93+
uses: docker/build-push-action@v5
94+
with:
95+
context: .
96+
build-args: |
97+
APP_VERSION=${{env.RELEASE_VERSION}}
98+
APP_GIT_COMMIT=${{env.COMMIT_SHA}}
99+
APP_GIT_BRANCH=main
100+
APP_BUILD_TIME=${{env.BUILD_TIME}}
101+
APP_GIT_REPOSITORY=${{github.repository}}
102+
file: ./.docker/Dockerfile.prod
103+
platforms: linux/amd64
104+
push: true
105+
tags: ghcr.io/${{ env.REPO_LC }}:${{ env.RELEASE_VERSION }}, ghcr.io/${{ env.REPO_LC }}:latest
106+
107+
- name: Notify management repo to update submodules
108+
uses: peter-evans/repository-dispatch@v3
109+
with:
110+
token: ${{ secrets.GREEN_ECOLUTION_PAT }}
111+
repository: green-ecolution/green-ecolution-management
112+
event-type: "update-submodules-production"
113+
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ env.COMMIT_SHA }}", "version": "${{ env.RELEASE_VERSION }}", "from": "frontend"}'
114+

0 commit comments

Comments
 (0)