-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #225 from green-ecolution/release/v1.0.0
Release v1.0.0
- Loading branch information
Showing
216 changed files
with
13,886 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
############################################# | ||
# Builder web | ||
############################################# | ||
FROM openapitools/openapi-generator-cli AS openapi-builder | ||
|
||
USER root | ||
RUN echo "java -jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar \$@" > /usr/local/bin/openapi-generator-cli \ | ||
&& chmod +x /usr/local/bin/openapi-generator-cli | ||
|
||
WORKDIR /app | ||
|
||
COPY ./backend-client/api-docs.json ./backend-client/openapi-generator.sh ./ | ||
|
||
RUN ./openapi-generator.sh local | ||
|
||
############################################# | ||
# Builder web | ||
############################################# | ||
FROM node:20-alpine AS builder-web | ||
|
||
ENV VITE_BACKEND_BASEURL=/api | ||
WORKDIR /app/build | ||
COPY ./backend-client/package.json ./backend-client/ | ||
COPY ./frontend/package.json ./frontend/ | ||
COPY ./yarn.lock ./package.json ./ | ||
RUN yarn --frozen-lockfile | ||
|
||
COPY ./backend-client/tsconfig.json ./backend-client/ | ||
COPY --from=openapi-builder /app/src ./backend-client/src | ||
RUN yarn build:backend-client | ||
|
||
COPY ./frontend ./frontend | ||
RUN yarn build:frontend:dev | ||
|
||
############################################# | ||
# Nginx | ||
############################################# | ||
FROM nginx:latest | ||
RUN rm /etc/nginx/conf.d/default.conf | ||
COPY .docker/nginx.conf /etc/nginx/conf.d/ | ||
COPY --from=builder-web /app/build/frontend/dist /usr/share/nginx/html | ||
|
||
EXPOSE 80 | ||
|
||
CMD ["nginx", "-g", "daemon off;"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
############################################# | ||
# Builder web | ||
############################################# | ||
FROM openapitools/openapi-generator-cli AS openapi-builder | ||
|
||
USER root | ||
RUN echo "java -jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar \$@" > /usr/local/bin/openapi-generator-cli \ | ||
&& chmod +x /usr/local/bin/openapi-generator-cli | ||
|
||
WORKDIR /app | ||
|
||
COPY ./backend-client/api-docs.json ./backend-client/openapi-generator.sh ./ | ||
|
||
RUN ./openapi-generator.sh local | ||
|
||
############################################# | ||
# Builder web | ||
############################################# | ||
FROM node:20-alpine AS builder-web | ||
|
||
ENV VITE_BACKEND_BASEURL=/api | ||
WORKDIR /app/build | ||
COPY ./backend-client/package.json ./backend-client/ | ||
COPY ./frontend/package.json ./frontend/ | ||
COPY ./yarn.lock ./package.json ./ | ||
RUN yarn --frozen-lockfile | ||
|
||
COPY ./backend-client/tsconfig.json ./backend-client/ | ||
COPY --from=openapi-builder /app/src ./backend-client/src | ||
RUN yarn build:backend-client | ||
|
||
COPY ./frontend ./frontend | ||
RUN yarn build:frontend | ||
|
||
############################################# | ||
# Nginx | ||
############################################# | ||
FROM nginx:latest | ||
RUN rm /etc/nginx/conf.d/default.conf | ||
COPY .docker/nginx.conf /etc/nginx/conf.d/ | ||
COPY --from=builder-web /app/build/frontend/dist /usr/share/nginx/html | ||
|
||
EXPOSE 80 | ||
|
||
CMD ["nginx", "-g", "daemon off;"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
############################################# | ||
# Builder web | ||
############################################# | ||
FROM openapitools/openapi-generator-cli AS openapi-builder | ||
|
||
USER root | ||
RUN echo "java -jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar \$@" > /usr/local/bin/openapi-generator-cli \ | ||
&& chmod +x /usr/local/bin/openapi-generator-cli | ||
|
||
WORKDIR /app | ||
|
||
COPY ./backend-client/api-docs.json ./backend-client/openapi-generator.sh ./ | ||
|
||
RUN ./openapi-generator.sh local | ||
|
||
############################################# | ||
# Builder web | ||
############################################# | ||
FROM node:20-alpine AS builder-web | ||
|
||
ENV VITE_BACKEND_BASEURL=/api | ||
WORKDIR /app/build | ||
COPY ./backend-client/package.json ./backend-client/ | ||
COPY ./frontend/package.json ./frontend/ | ||
COPY ./yarn.lock ./package.json ./ | ||
RUN yarn --frozen-lockfile | ||
|
||
COPY ./backend-client/tsconfig.json ./backend-client/ | ||
COPY --from=openapi-builder /app/src ./backend-client/src | ||
RUN yarn build:backend-client | ||
|
||
COPY ./frontend ./frontend | ||
RUN yarn build:frontend:stage | ||
|
||
############################################# | ||
# Nginx | ||
############################################# | ||
FROM nginx:latest | ||
RUN rm /etc/nginx/conf.d/default.conf | ||
COPY .docker/nginx.conf /etc/nginx/conf.d/ | ||
COPY --from=builder-web /app/build/frontend/dist /usr/share/nginx/html | ||
|
||
EXPOSE 80 | ||
|
||
CMD ["nginx", "-g", "daemon off;"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
backend-client/** | ||
!backend-client/openapi-generator.sh | ||
!backend-client/api-docs.json | ||
!backend-client/package.json | ||
!backend-client/tsconfig.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[*.{ts,tsx,json}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Build and Push Docker Image Develop | ||
"on": | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
build_and_deploy_dev: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
actions: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Set commit sha | ||
run: | | ||
echo "COMMIT_SHA=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_ENV | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: set lower case owner name | ||
run: | | ||
echo "REPO_LC=${REPO,,}" >>${GITHUB_ENV} | ||
env: | ||
REPO: "${{ github.repository }}" | ||
|
||
- name: get build time | ||
run: | | ||
echo "BUILD_TIME=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >>${GITHUB_ENV} | ||
- name: Get api docs artifacts | ||
env: | ||
GH_TOKEN: ${{ secrets.GREEN_ECOLUTION_PAT }} | ||
run: | | ||
gh run download -R green-ecolution/green-ecolution-backend -n api-docs.json | ||
mv api-docs.json ./backend-client/api-docs.json | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
build-args: | | ||
APP_VERSION="development" | ||
APP_GIT_COMMIT=${{env.COMMIT_SHA}} | ||
APP_GIT_BRANCH="develop" | ||
APP_BUILD_TIME=${{env.BUILD_TIME}} | ||
APP_GIT_REPOSITORY=${{github.repository}} | ||
file: ./.docker/Dockerfile.dev | ||
platforms: linux/amd64 #,linux/arm64 | ||
push: true | ||
tags: ghcr.io/${{ env.REPO_LC }}-dev:latest, ghcr.io/${{ env.REPO_LC }}-dev:${{ env.COMMIT_SHA }} | ||
|
||
- name: Notify management repo to update submodules | ||
uses: peter-evans/repository-dispatch@v3 | ||
with: | ||
token: ${{ secrets.GREEN_ECOLUTION_PAT }} | ||
repository: green-ecolution/green-ecolution-management | ||
event-type: "update-submodules" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
name: Build and Push Docker Image Production | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: | ||
- closed | ||
|
||
jobs: | ||
build_and_deploy_prod: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true && | ||
(startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix/')) | ||
permissions: | ||
contents: write | ||
packages: write | ||
actions: write | ||
pull-requests: write | ||
steps: | ||
- name: Extract version from branch name (for release branches) | ||
if: startsWith(github.event.pull_request.head.ref, 'release/') | ||
run: | | ||
BRANCH_NAME="${{ github.event.pull_request.head.ref }}" | ||
VERSION=${BRANCH_NAME#release/} | ||
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV | ||
- name: Extract version from branch name (for hotfix branches) | ||
if: startsWith(github.event.pull_request.head.ref, 'hotfix/') | ||
run: | | ||
BRANCH_NAME="${{ github.event.pull_request.head.ref }}" | ||
VERSION=${BRANCH_NAME#hotfix/} | ||
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV | ||
- name: Create Release | ||
uses: thomaseizinger/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
target_commitish: ${{ github.event.pull_request.merge_commit_sha }} | ||
tag_name: ${{ env.RELEASE_VERSION }} | ||
name: ${{ env.RELEASE_VERSION }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Merge main into develop branch | ||
uses: thomaseizinger/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
head: main | ||
base: develop | ||
title: Merge main into develop branch | ||
body: | | ||
This PR merges the main branch back into develop. | ||
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. | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: set lower case owner name | ||
run: | | ||
echo "REPO_LC=${REPO,,}" >>${GITHUB_ENV} | ||
env: | ||
REPO: "${{ github.repository }}" | ||
|
||
- name: get build time | ||
run: | | ||
echo "BUILD_TIME=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >>${GITHUB_ENV} | ||
- name: Get api docs artifacts | ||
env: | ||
GH_TOKEN: ${{ secrets.GREEN_ECOLUTION_PAT }} | ||
run: | | ||
gh run download -R green-ecolution/green-ecolution-backend -n api-docs-${{ env.RELEASE_VERSION }}.json | ||
mv api-docs-${{ env.RELEASE_VERSION }}.json ./backend-client/api-docs.json | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
build-args: | | ||
APP_VERSION=${{env.RELEASE_VERSION}} | ||
APP_GIT_COMMIT=${{env.COMMIT_SHA}} | ||
APP_GIT_BRANCH=main | ||
APP_BUILD_TIME=${{env.BUILD_TIME}} | ||
APP_GIT_REPOSITORY=${{github.repository}} | ||
file: ./.docker/Dockerfile.prod | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ghcr.io/${{ env.REPO_LC }}:${{ env.RELEASE_VERSION }}, ghcr.io/${{ env.REPO_LC }}:latest | ||
|
||
- name: Notify management repo to update submodules | ||
uses: peter-evans/repository-dispatch@v3 | ||
with: | ||
token: ${{ secrets.GREEN_ECOLUTION_PAT }} | ||
repository: green-ecolution/green-ecolution-management | ||
event-type: "update-submodules-production" | ||
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ env.COMMIT_SHA }}", "version": "${{ env.RELEASE_VERSION }}", "from": "frontend"}' | ||
|
Oops, something went wrong.