Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Notifications project
web-portal
Commits
bf69907a
Commit
bf69907a
authored
Jan 05, 2021
by
Caetan Tojeiro Carpente
Browse files
[
#19
] Fix web-portal Dockerfile
parent
8ffa34bf
Pipeline
#2233846
passed with stages
in 5 minutes and 30 seconds
Changes
6
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
.dockerignore
0 → 100644
View file @
bf69907a
node_modules
npm-debug.log
README.md
.vscode
.gitlab-ci.yml
View file @
bf69907a
...
...
@@ -6,21 +6,10 @@ variables:
RESOURCE
:
web-portal-image-stream
stages
:
-
Build_App
-
Build
-
Tag_Image
-
Import_Image
.build_app
:
stage
:
Build_App
image
:
node:12-alpine
script
:
-
yarn install
-
npx env-cmd -f ".env.$BUILD_ENV" yarn build
artifacts
:
paths
:
-
build
.build
:
stage
:
Build
tags
:
...
...
@@ -42,16 +31,6 @@ stages:
script
:
-
oc import-image ${RESOURCE}:${TAG} --token=${TOKEN} --server=${OPENSHIFT_SERVER} -n ${NAMESPACE}
build_app
:
extends
:
.build_app
variables
:
BUILD_ENV
:
${BUILD_ENV_DEV}
rules
:
-
if
:
$CI_MERGE_REQUEST_ID
when
:
manual
-
if
:
$CI_COMMIT_TAG || $CI_COMMIT_BRANCH == 'master'
-
when
:
never
# Build image and store it in the registry.
build
:
extends
:
.build
...
...
Dockerfile
View file @
bf69907a
FROM
node:alpine AS build
WORKDIR
/usr/src/app
COPY
. .
RUN
apk update
&&
apk add python2 build-base
&&
npm
install
&&
npm run build
FROM
node:alpine
WORKDIR
/usr/src/app
COPY
.
/build .
COPY
--from=build /usr/src/app
/build .
/build
RUN
yarn global add
serve
RUN
npm
install
-g
serve
EXPOSE
5
000
EXPOSE
3
000
CMD
serve
-s -p
3000
.
CMD
["
serve
", "-s", "build", "-l", "
3000
"]
README.md
View file @
bf69907a
## System requirements
-
[
Nodejs
](
https://nodejs.org/en/
)
-
[
Yarn
](
https://
classic.yarnpkg.com/en/docs/install
)
-
[
npm
](
https://
docs.npmjs.com/downloading-and-installing-node-js-and-npm
)
## Start web portal application
1.
In the root folder run
```
yarn
install
npm
install
```
2.
After installing all the dependencies, you should be able to run the project
```
yarn
start
```
```
npm
start
```
## Test docker image locally
The Dockerfile is meant to build the image that is going to be used in the production environment,
so it expects to use the production build of the web-portal application. So first of all we should build the application:
```
npx env-cmd -f .env cross-env yarn build
```
When the build is finished, we can build the docker image to test the production build of the system:
We can build the docker image to test the production build of the system:
```
docker build . -t web-portal
```
Once it is built, we can run the container with the app listening on
`http://localhost:3000`
:
```
docker run -p 3000:3000 web-portal
```
package.json
View file @
bf69907a
...
...
@@ -40,7 +40,7 @@
"start"
:
"HTTPS=true npm-run-all -p watch-css start-js"
,
"build-js"
:
"react-scripts build"
,
"build"
:
"npm-run-all build-css build-js"
,
"build-dev"
:
"npx env-cmd -f .env cross-env
yarn
build"
,
"build-dev"
:
"npx env-cmd -f .env cross-env
npm
build"
,
"test"
:
"react-scripts test --env=jsdom"
,
"eject"
:
"react-scripts eject"
,
"start-prod"
:
"serve -s ./build"
...
...
public/index.html
View file @
bf69907a
...
...
@@ -38,8 +38,8 @@
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm
start` or `yarn
start`.
To create a production bundle, use `npm run
build` or `yarn
build`.
To begin the development, run `npm start`.
To create a production bundle, use `npm run build`.
-->
</body>
...
...
Caetan Tojeiro Carpente
@ctojeiro
mentioned in merge request
backend!31 (merged)
·
Jan 18, 2021
mentioned in merge request
backend!31 (merged)
mentioned in merge request backend!31
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment