WIP: feat(deployment): add automatic deployment with docker images for frontend (CAS-16) (CAS-20) #8

Closed
csimonis wants to merge 9 commits from feature/deployment into main
5 changed files with 47 additions and 32 deletions

View File

@ -0,0 +1,26 @@
name: Build and push Docker image
on: push
# pull_request:
# types:
# - closed
# branches:
# - main
jobs:
build:
runs-on: remote
steps:
- name: Checkout
uses: https://git.simonis.lol/actions/checkout@v4
- name: Build
run: docker buildx build -f frontend/.docker/Dockerfile -t git.simonis.lol/projects/casino:frontend-latest frontend
- name: Login
uses: https://git.simonis.lol/actions/login@v1
with:
registry: git.simonis.lol
username: ${{ vars.DOCKER_USER }}
password: ${{ vars.DOCKER_PW }}
- name: Push
run: docker push git.simonis.lol/projects/casino:frontend-latest

View File

@ -0,0 +1,15 @@
FROM oven/bun:latest AS build
WORKDIR /app
ENV NODE_ENV=production
COPY .. .
RUN bun install --prod
RUN bun run build
FROM oven/bun:latest AS prod
WORKDIR /app
COPY --from=build /app /app
CMD ["bun", "run", "start"]

5
frontend/.dockerignore Normal file
View File

@ -0,0 +1,5 @@
.angular
node_modules
dist
.git
.docker

View File

@ -1,31 +0,0 @@
version: '3'
volumes:
employee_postgres_data:
driver: local
services:
postgres-employee:
container_name: postgres_employee
image: postgres:13.3
volumes:
- employee_postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_DB: employee_db
POSTGRES_USER: employee
POSTGRES_PASSWORD: secret
ports:
- "5432:5432"
employee:
container_name: employee
image: berndheidemann/employee-management-service:1.0.4
# image: berndheidemann/employee-management-service_without_keycloak:1.1
environment:
spring.datasource.url: jdbc:postgresql://postgres-employee:5432/employee_db
spring.datasource.username: employee
spring.datasource.password: secret
ports:
- "8089:8089"
depends_on:
- postgres-employee

View File

@ -4,7 +4,7 @@
"scripts": { "scripts": {
"ng": "bunx @angular/cli", "ng": "bunx @angular/cli",
"start": "bunx @angular/cli serve --proxy-config src/proxy.conf.json", "start": "bunx @angular/cli serve --proxy-config src/proxy.conf.json",
"build": "bunx @angular/cli build", "build": "bunx @angular/cli build --no-watch",
"watch": "bunx @angular/cli build --watch --configuration development", "watch": "bunx @angular/cli build --watch --configuration development",
"test": "bunx @angular/cli test", "test": "bunx @angular/cli test",
"format": "prettier --write \"src/**/*.{ts,html,css,scss}\"", "format": "prettier --write \"src/**/*.{ts,html,css,scss}\"",