Skip to content

Add configuration for arm #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Dockerfile-arm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Usage:
#
# Build image:
# docker build -t jojozhuang/text-compare-angular-arm . -f Dockerfile-ARM
#
# Run image (on localhost:12010):
# docker run -d --name text-compare -p 12010:80 jojozhuang/text-compare-angular-arm
#
# Run image as virtual host (read more: https://github.com/nginx-proxy/nginx-proxy):
# docker run -e VIRTUAL_HOST=text-compare.your-domain.com --name text-compare jojozhuang/text-compare-angular

# Stage 1, based on Node.js, to build and compile Angular

FROM node:16.10.0-alpine as builder

WORKDIR /ng-app

COPY package*.json tsconfig*.json angular.json ./
COPY ./src ./src

RUN npm ci --quiet && npm run build-nas

# Stage 2, based on Nginx, to have only the compiled app, ready for production with Nginx

FROM arm64v8/nginx

COPY ./nginx.conf /etc/nginx/conf.d/default.conf

## From ‘builder’ stage copy over the artifacts in dist folder to default nginx public folder
COPY --from=builder /ng-app/dist /usr/share/nginx/html
44 changes: 44 additions & 0 deletions k8s/text-compare-arm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Setup loocally
# 1. Build image for ARM platform
# docker build -t text-compare-angular . -f Dockerfile-ARM
# 2. Deploy to k8s:
# kubectl apply -f k8s/text-compare.yaml
# 3. Create service in minikube:
# minikube service text-compare-service
# 4. Access the url from step 3.

apiVersion: apps/v1
kind: Deployment
metadata:
name: text-compare-deployment
labels:
app: text-compare
spec:
replicas: 1
selector:
matchLabels:
app: text-compare
template:
metadata:
labels:
app: text-compare
spec:
containers:
- name: text-compare
image: jojozhuang/text-compare-angular
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: text-compare-service
spec:
selector:
app: text-compare
type: LoadBalancer # assign an external IP address to accept external request
ports:
- protocol: TCP
port: 12011
targetPort: 80
nodePort: 31000 # must be between 30000 and 32767