generated from amosproj/amos202Xss0Y-projname
-
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 #21 from amosproj/feat/xd-10
feat: Add GitHub Pipelines (#10)
- Loading branch information
Showing
15 changed files
with
348 additions
and
65 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,22 @@ | ||
# Ignore files and directories generated by npm or yarn | ||
node_modules | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
# Ignore build artifacts and temporary files | ||
/dist | ||
/tmp | ||
/out-tsc | ||
#/**/*.d.ts | ||
|
||
# Ignore development-specific files | ||
*.md | ||
/Deliverables | ||
/Documentation | ||
|
||
# Ignore version control files | ||
.git | ||
|
||
# Ignore Docker-specific files | ||
.dockerignore | ||
docker-compose.yml |
This file was deleted.
Oops, something went wrong.
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,97 @@ | ||
name: Docker Build and Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: amosproj/amos2024ss01-xcelerator-demo-app | ||
|
||
jobs: | ||
setup-buildx: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
backend: | ||
runs-on: ubuntu-latest | ||
needs: setup-buildx | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-backend | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=sha | ||
latest | ||
- name: Log in to registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push backend image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./apps/backend/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
frontend: | ||
runs-on: ubuntu-latest | ||
needs: setup-buildx | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-frontend | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=sha | ||
latest | ||
- name: Log in to registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push frontend image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./apps/frontend/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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
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,20 @@ | ||
name: Release Please | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/release-please-action@v4 | ||
with: | ||
release-type: node | ||
package-name: xcelerator-demo | ||
target-branch: main |
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 |
---|---|---|
@@ -1 +1 @@ | ||
22.0.0 | ||
20.12.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,37 @@ | ||
FROM node:20-alpine as base | ||
|
||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN corepack enable | ||
|
||
WORKDIR /usr/src/app | ||
|
||
RUN corepack prepare [email protected] --activate | ||
|
||
FROM base as installer | ||
|
||
COPY package.json ./ | ||
COPY pnpm-lock.yaml ./ | ||
|
||
RUN pnpm install --frozen-lockfile --prod | ||
|
||
FROM base as builder | ||
|
||
ENV NX_DEAMON="false" | ||
|
||
COPY --from=installer /usr/src/app/node_modules ./node_modules | ||
|
||
COPY . . | ||
|
||
RUN pnpm install --frozen-lockfile | ||
RUN pnpm nx build backend | ||
|
||
FROM node:20-alpine as production | ||
|
||
COPY --from=installer /usr/src/app/node_modules ./node_modules | ||
COPY --from=builder /usr/src/app/dist/apps/backend ./dist/ | ||
|
||
EXPOSE 3000 | ||
EXPOSE 9229 | ||
|
||
CMD ["node", "./dist/main.js"] |
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
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,33 @@ | ||
FROM node:20-alpine as base | ||
|
||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN corepack enable | ||
|
||
WORKDIR /usr/src/app | ||
|
||
RUN corepack prepare [email protected] --activate | ||
|
||
FROM base as installer | ||
|
||
COPY package.json ./ | ||
COPY pnpm-lock.yaml ./ | ||
|
||
RUN pnpm install --frozen-lockfile | ||
|
||
FROM base as builder | ||
|
||
ENV NX_DEAMON="false" | ||
|
||
COPY --from=installer /usr/src/app/node_modules ./node_modules | ||
|
||
COPY . . | ||
|
||
RUN pnpm nx build frontend | ||
|
||
FROM nginx:stable-alpine as production | ||
|
||
COPY apps/frontend/nginx.conf /etc/nginx/conf.d/default.conf | ||
COPY --from=builder /usr/src/app/dist/apps/frontend /usr/share/nginx/html | ||
|
||
EXPOSE 80 |
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,26 @@ | ||
# Gzip Settings | ||
gzip on; | ||
gzip_disable “MSIE [1-6]\.(?!.*SV1)”; | ||
gzip_vary on; | ||
gzip_proxied any; | ||
gzip_comp_level 6; | ||
gzip_buffers 32 16k; | ||
gzip_http_version 1.1; | ||
gzip_min_length 250; | ||
gzip_types image/jpeg image/bmp image/svg+xml text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon; | ||
|
||
# security headers | ||
add_header Referrer-Policy "no-referrer-when-downgrade" always; | ||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always; | ||
|
||
server { | ||
|
||
listen 80; | ||
root /usr/share/nginx/html; | ||
autoindex on; | ||
|
||
location / { | ||
try_files $uri $uri/ /index.html =404; | ||
} | ||
|
||
} |
Oops, something went wrong.