Skip to content
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
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
npm-debug.log
Dockerfile
.dockerignore
.git
.gitignore
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:20-alpine3.19 AS build

WORKDIR /app
COPY package*.json ./
RUN npm install
RUN npm cache clean --force
COPY . .
EXPOSE 3000
RUN npm run build
RUN mkdir /app/build/nginx_status
COPY status.html /app/build/nginx_status/index.html

FROM nginxinc/nginx-unprivileged AS production
#COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/build /usr/share/nginx/html


EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]
18 changes: 18 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
echo "building image"
docker compose build

echo "Login to OpenShift"
echo "openshift username:"
read username
oc login -u $username api.ul-pca-pr-ul01.ulaval.ca:6443

oc project ul-val-genovalia-pr

echo "Login to Registry"
docker login -u `oc whoami` -p `oc whoami --show-token` registre.apps.ul-pca-pr-ul01.ulaval.ca

echo "Push image"
docker push registre.apps.ul-pca-pr-ul01.ulaval.ca/ul-val-genovalia-pr/semantic-engine:latest

echo "Deploying image"
oc rollout latest dc/semantic-engine
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
semantic-engine:
build: .
image: registre.apps.ul-pca-pr-ul01.ulaval.ca/ul-val-genovalia-pr/semantic-engine:latest
ports:
- "3000:8080"
environment:
REACT_APP_GA_ID: 0
44 changes: 44 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
server {
listen 8080;
listen [::]:8080;
server_name localhost;

#access_log /var/log/nginx/host.access.log main;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
87 changes: 87 additions & 0 deletions oc-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# openshift deployment config
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig

metadata:
name: semantic-engine
labels:
app: semantic-engine
namespace: ul-val-genovalia-pr
spec:
replicas: 1
revisionHistoryLimit: 1
selector:
app: semantic-engine
deploymentconfig: semantic-engine
strategy:
type: Rolling
resources: {}
activeDeadlineSeconds: 21600
template:
metadata:
labels:
app: semantic-engine
deploymentconfig: semantic-engine
spec:
containers:
- name: semantic-engine
securityContext:
runAsUser: 1002360001
runAsGroup: 1002360001
image: registre.apps.ul-pca-pr-ul01.ulaval.ca/ul-val-genovalia-pr/semantic-engine:latest
ports:
- containerPort: 8080
protocol: TCP
resources:
limits:
cpu: 250m
memory: 512Mi
requests:
cpu: 250m
memory: 512Mi


restartPolicy: Always
terminationGracePeriodSeconds: 10
dnsPolicy: ClusterFirst
schedulerName: default-scheduler
---
# service
apiVersion: v1
kind: Service
metadata:
name: semantic-engine-service
labels:
app: semantic-engine
namespace: ul-val-genovalia-pr
spec:
ports:
- name: 8080-tcp
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: semantic-engine
sessionAffinity: None
type: ClusterIP
---
# route
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: semantic-engine
labels:
app: semantic-engine
namespace: ul-val-genovalia-pr
spec:
host: semantic-engine.apps.genovalia.ulaval.ca
port:
targetPort: 8080-tcp
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
to:
kind: Service
name: semantic-engine-service
weight: 100
wildcardPolicy: None
1 change: 1 addition & 0 deletions status.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OK