Skip to content

Commit 1edcdcd

Browse files
committed
swap react app for Oracle Jet app
1 parent 09536a1 commit 1edcdcd

File tree

9 files changed

+106
-27
lines changed

9 files changed

+106
-27
lines changed

app/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ FROM nginx:1.23-alpine-slim
22

33
RUN apk add --update nodejs npm
44

5-
65
WORKDIR /usr/share/build
76

87
RUN mkdir -p /usr/share/build/src \
@@ -16,8 +15,10 @@ COPY *.json /usr/share/build/
1615

1716
RUN npm install
1817
RUN npm install -g @oracle/ojet-cli
19-
RUN npx ojet build web --release
18+
RUN ojet build web --release
19+
20+
RUN cp -R /usr/share/build/web/* /usr/share/nginx/html/
2021

2122
EXPOSE 80
2223

23-
RUN cp -R /usr/share/build/web/* /usr/share/nginx/html/
24+
CMD ["nginx", "-g", "daemon off;"]

deploy/k8s/app/app-svc.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
labels:
5+
app: app
6+
name: app
7+
spec:
8+
ports:
9+
- port: 80
10+
protocol: TCP
11+
targetPort: 80
12+
selector:
13+
app: app

deploy/k8s/app/app.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
labels:
5+
app: app
6+
name: app
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: app
12+
strategy:
13+
type: RollingUpdate
14+
rollingUpdate:
15+
maxSurge: 1
16+
maxUnavailable: 1
17+
template:
18+
metadata:
19+
labels:
20+
app: app
21+
spec:
22+
containers:
23+
- image: app
24+
name: app
25+
readinessProbe:
26+
httpGet:
27+
scheme: HTTP
28+
path: /index.html
29+
port: 80
30+
initialDelaySeconds: 10
31+
periodSeconds: 5
32+
ports:
33+
- containerPort: 80
34+
resources:
35+
requests:
36+
cpu: 100m
37+
memory: 256Mi
38+
limits:
39+
cpu: 250m
40+
memory: 521Mi
41+
imagePullSecrets:
42+
- name: ocir-secret

deploy/k8s/app/kustomization.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
resources:
2+
- app.yaml
3+
- app-svc.yaml
4+
namespace: backend

deploy/k8s/ingress/ingress.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ spec:
2323
name: backend
2424
port:
2525
number: 8080
26-
- path: /summary
27-
pathType: Prefix
28-
backend:
29-
service:
30-
name: web
31-
port:
32-
number: 80
26+
# - path: /summary
27+
# pathType: Prefix
28+
# backend:
29+
# service:
30+
# name: web
31+
# port:
32+
# number: 80
3333
- path: /
3434
pathType: Prefix
3535
backend:
3636
service:
37-
name: web
37+
name: app
3838
port:
3939
number: 80

deploy/k8s/overlays/prod/kustomization.yaml.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
resources:
22
- "../../ingress"
3-
- "../../web"
3+
- "../../app"
44
- "../../backend"
55

66
images:
7-
- name: web
8-
newName: {{region_key}}.ocir.io/{{{tenancy_namespace}}}/{{{project_name}}}/web
7+
- name: app
8+
newName: {{region_key}}.ocir.io/{{{tenancy_namespace}}}/{{{project_name}}}/app
99
newTag: {{{web_version}}}
1010
- name: backend
1111
newName: {{region_key}}.ocir.io/{{{tenancy_namespace}}}/{{{project_name}}}/backend

deploy/terraform/.terraform.lock.hcl

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/kustom.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const namespace = config.get("namespace");
1919
const regionName = config.get("regionName");
2020
const regionKey = config.get("regionKey");
2121
const webVersion = config.get("webVersion");
22+
const appVersion = config.get("appVersion");
2223
const backendVersion = config.get("backendVersion");
2324
const certFullchain = config.get("certFullchain");
2425
const certPrivateKey = config.get("certPrivateKey");
@@ -71,6 +72,7 @@ async function createProdKustomization() {
7172
region_key: regionKey,
7273
tenancy_namespace: namespace,
7374
project_name: projectName,
75+
app_version: appVersion,
7476
web_version: webVersion,
7577
backend_version: backendVersion,
7678
});

scripts/release.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ const pwdOutput = (await $`pwd`).stdout.trim();
3232
await cd(`${pwdOutput}/web`);
3333
const webVersion = await getNpmVersion();
3434
config.set("webVersion", webVersion);
35+
await cd(`${pwdOutput}/app`);
36+
const appVersion = await getNpmVersion();
37+
config.set("appVersion", appVersion);
3538
await cd(`${pwdOutput}/backend`);
3639
const backendVersion = await getVersionGradle();
3740
config.set("backendVersion", backendVersion);
@@ -51,6 +54,7 @@ config.set("ocir_user_token", ocir_user_token);
5154

5255
await containerLogin(namespace, ocir_user, ocir_user_token, ocirUrl);
5356
await releaseWeb();
57+
await releaseApp();
5458
await releaseBackend();
5559

5660
async function releaseWeb() {
@@ -66,6 +70,19 @@ async function releaseWeb() {
6670
await cd("..");
6771
}
6872

73+
async function releaseApp() {
74+
const service = "app";
75+
await cd(service);
76+
const imageName = `${projectName}/${service}`;
77+
await buildImage(`localhost/${imageName}`, appVersion);
78+
const localImage = `localhost/${imageName}:${appVersion}`;
79+
const remoteImage = `${ocirUrl}/${namespace}/${imageName}:${appVersion}`;
80+
await tagImage(localImage, remoteImage);
81+
await pushImage(remoteImage);
82+
console.log(`${chalk.green(remoteImage)} pushed`);
83+
await cd("..");
84+
}
85+
6986
async function releaseBackend() {
7087
const service = "backend";
7188
await cd(service);

0 commit comments

Comments
 (0)