Skip to content
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

MOSIP-32346 added dockerfile #276

Merged
merged 1 commit into from
May 6, 2024
Merged
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
74 changes: 74 additions & 0 deletions pmp-reactjs-ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# base image
FROM nginx

ARG SOURCE
ARG COMMIT_HASH
ARG COMMIT_ID
ARG BUILD_TIME
LABEL source=${SOURCE}
LABEL commit_hash=${COMMIT_HASH}
LABEL commit_id=${COMMIT_ID}
LABEL build_time=${BUILD_TIME}

ENV base_path=/usr/share/nginx/html

ENV i18n_path=${base_path}/assets/i18n

ENV entity_spec_path=${base_path}/assets/entity-spec

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user=mosip

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_group=mosip

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_uid=1001

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_gid=1001

# install packages and create user
RUN apt-get -y update \
&& apt-get install -y unzip wget \
&& groupadd -g ${container_user_gid} ${container_user_group} \
&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \
&& mkdir -p /var/run/nginx /var/tmp/nginx \
&& chown -R ${container_user}:${container_user} /usr/share/nginx /var/run/nginx /var/tmp/nginx

# set working directory for the user
WORKDIR /home/${container_user}

ADD ./nginx.conf /etc/nginx/nginx.conf

ADD default.conf /etc/nginx/conf.d/

ADD dist ${base_path}

# can be passed during Docker build as build time environment for artifactory URL
ARG artifactory_url
# environment variable to pass artifactory url, at docker runtime
ENV artifactory_url_env=${artifactory_url}

# install the needed packages including wget and a unzip library
#RUN apt-get update -y && apt-get install -y wget && apt-get install -y unzip

# change permissions of file inside working dir
RUN chown -R ${container_user}:${container_user} ${base_path}/assets/i18n
RUN chown -R ${container_user}:${container_user} ${base_path}/assets/entity-spec

# select container user for all tasks
USER ${container_user_uid}:${container_user_gid}

EXPOSE 8080

#get the pmp i18n bundle zip from artifactory
CMD wget -q --show-progress "${artifactory_url_env}"/artifactory/libs-release-local/i18n/pmp-i18n-bundle.zip -O "${i18n_path}"/pmp-i18n-bundle.zip ; \
wget -q --show-progress "${artifactory_url_env}"/artifactory/libs-release-local/i18n/pmp-entity-spec-bundle.zip -O "${entity_spec_path}"/pmp-entity-spec-bundle.zip ; \
cd ${entity_spec_path} ; \
unzip -o pmp-entity-spec-bundle.zip ; \
cd ${i18n_path} ; \
unzip -o pmp-i18n-bundle.zip ; \
nginx ; \
sleep infinity

14 changes: 14 additions & 0 deletions pmp-reactjs-ui/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
server {
listen 8080;
server_name localhost;
add_header X-Frame-Options DENY;

#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;

index index.html index.htm;
location /pmp-reactjs-ui {
alias /usr/share/nginx/html;
}

}
2 changes: 1 addition & 1 deletion pmp-reactjs-ui/src/auth/AppRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { createHashRouter, RouterProvider, Navigate, redirect } from 'react-rout
import GuardedRoute from './GuardedRoute.js';

import MainLayout from '../pages/MainLayout.js';
import NewPage from '../pages/NewPage.js';
import Dashboard from '../pages/Dashboard.js';
import PartnerCertificate from '../pages/PartnerCertificate.js';

function AppRoutes() {
const router = createHashRouter([
Expand Down
2 changes: 1 addition & 1 deletion pmp-reactjs-ui/src/pages/SideNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ManageSBIInformation } from '../sideNaveOptions/ManageSBIInformation';
import { ManagePartnerProfile } from '../sideNaveOptions/ManagePartnerProfile';

function SideNav() {
const [open, setOpen] = useState(true);
const [open, setOpen] = useState(false);
const [activeIcon, setActiveIcon] = useState(false);

const Options = [
Expand Down
Loading