Skip to content

Commit 6850c70

Browse files
committed
Workflow hinzugefügt
- Angular app wird gebaut - Angular App wird als Image in DockerHub gepushed - Readme Anpassungen
1 parent 1f39bf0 commit 6850c70

File tree

8 files changed

+128
-90
lines changed

8 files changed

+128
-90
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
docker-compose*.yml
4+
*.log
5+
.git
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build and Deploy Script
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v4
14+
15+
- name: Adding Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 22.16.0
19+
cache: 'npm'
20+
21+
- name: Install Dependencies
22+
run: npm install
23+
24+
- name: Run Unit Tests
25+
run: npm test -- --watch=false --browsers=ChromeHeadless
26+
27+
- name: Build Angular App for production
28+
run: npm run build -- --configuration=production
29+
30+
- name: Upload Build Artifact
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: angular-dist
34+
path: dist/
35+
docker:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Login to Docker Hub
39+
uses: docker/login-action@v3
40+
with:
41+
username: ${{ vars.DOCKERHUB_USERNAME }}
42+
password: ${{ secrets.DOCKERHUB_TOKEN }}
43+
44+
- name: Set up QEMU
45+
uses: docker/setup-qemu-action@v3
46+
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v3
49+
50+
- name: Build and push
51+
uses: docker/build-push-action@v6
52+
with:
53+
push: true
54+
tags: ${{ vars.DOCKERHUB_USERNAME }}/angular-demo-application:latest
55+
cache-from: type=gha
56+
cache-to: type=gha,mode=max

.vscode/extensions.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

.vscode/launch.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

.vscode/tasks.json

Lines changed: 0 additions & 42 deletions
This file was deleted.

Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# -------------------------------------------------
2+
# 1) Build-Stage
3+
# -------------------------------------------------
4+
FROM node:22.16.0-alpine AS builder
5+
6+
# Arbeitsverzeichnis im Container
7+
WORKDIR /app
8+
9+
# Nur package.json und lockfile kopieren, um Layer-Caching zu ermöglichen
10+
COPY package*.json ./
11+
12+
# Abhängigkeiten installieren
13+
RUN npm ci --legacy-peer-deps
14+
15+
# Rest des Quellcodes kopieren
16+
COPY . .
17+
18+
# Angular CLI lokal installieren (falls nicht in devDependencies)
19+
RUN npm install @angular/cli@latest --no-save
20+
21+
# Anwendung bauen
22+
RUN npx ng build --configuration=production
23+
24+
# -------------------------------------------------
25+
# 2) Production-Stage
26+
# -------------------------------------------------
27+
FROM nginx:1.25-alpine AS production
28+
29+
# Entferne standardmäßiges nginx HTML
30+
RUN rm -rf /usr/share/nginx/html/*
31+
32+
# Kopiere die gebauten Dateien aus dem Builder
33+
COPY --from=builder /app/dist/angular-demo-application /usr/share/nginx/html
34+
35+
# Exponiere Port
36+
EXPOSE 80
37+
38+
# Default-Command
39+
CMD ["nginx", "-g", "daemon off;"]

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Kirill Esau
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,10 @@
1-
# AngularDemoApplication
1+
# Angular Demo Application
22

3-
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.0.4.
3+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4+
![GitHub last commit](https://img.shields.io/github/last-commit/kirillesau/angular-demo-application)
5+
[![Build and Deploy Script](https://github.com/kirillesau/angular-demo-application/actions/workflows/build-application.yml/badge.svg?branch=master)](https://github.com/kirillesau/angular-demo-application/actions/workflows/build-application.yml)
46

5-
## Development server
7+
An example application with angular.
8+
## Prerequisite
69

7-
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
8-
9-
## Code scaffolding
10-
11-
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12-
13-
## Build
14-
15-
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
16-
17-
## Running unit tests
18-
19-
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20-
21-
## Running end-to-end tests
22-
23-
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
24-
25-
## Further help
26-
27-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
10+
The example has been created for learning purposes only.

0 commit comments

Comments
 (0)