Skip to content

Commit 44fd108

Browse files
DevTools Week: Create devfile for landing page and registry viewer (#78)
* bash cmd changed to sh cmd. Signed-off-by: Michael Valdron <[email protected]> * vscode spec setting changes. Signed-off-by: Michael Valdron <[email protected]> * odo ignores added. Signed-off-by: Michael Valdron <[email protected]> * devfile-web devfile added. Signed-off-by: Michael Valdron <[email protected]> --------- Signed-off-by: Michael Valdron <[email protected]>
1 parent 0c9f5ec commit 44fd108

File tree

4 files changed

+132
-3
lines changed

4 files changed

+132
-3
lines changed

.devfile.yaml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
#
2+
# Copyright 2023 Red Hat, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
schemaVersion: 2.2.0
17+
metadata:
18+
name: devfile-web
19+
displayName: Devfile Web Services
20+
description: A devworkspace for devfile web services.
21+
language: TypeScript
22+
projectType: Next.js
23+
tags:
24+
- TypeScript
25+
- Node.js
26+
- Next.js
27+
- Devfile
28+
- Registry
29+
- Documentation
30+
- devfile.io
31+
version: 1.0.0
32+
components:
33+
- name: image-builder
34+
image:
35+
imageName: "quay.io/{{profile}}/{{project}}:{{imageTag}}"
36+
dockerfile:
37+
args:
38+
- --build-arg=PROJECT_NAME={{project}}
39+
uri: Dockerfile
40+
- name: runner
41+
attributes:
42+
container-overrides:
43+
securityContext:
44+
runAsUser: 1001
45+
allowPrivilegeEscalation: false
46+
runAsNonRoot: true
47+
capabilities:
48+
drop: ["ALL"]
49+
seccompProfile:
50+
type: "RuntimeDefault"
51+
container:
52+
image: node:16-alpine
53+
command: ['tail', '-f', '/dev/null']
54+
mountSources: true
55+
memoryLimit: "{{memoryLimit}}"
56+
volumeMounts:
57+
- name: cache
58+
path: /.cache
59+
- name: yarn-global
60+
path: /.yarn
61+
- name: npm-global
62+
path: /.npm
63+
endpoints:
64+
- name: http-4200
65+
protocol: http
66+
targetPort: 4200
67+
env:
68+
- name: DEPLOY_CONFIG
69+
value: "{{deployConfig}}"
70+
- name: cache
71+
volume:
72+
ephemeral: true
73+
size: 10Gi
74+
- name: yarn-global
75+
volume:
76+
ephemeral: true
77+
- name: npm-global
78+
volume:
79+
ephemeral: true
80+
commands:
81+
# Install dependency packages
82+
- id: build
83+
exec:
84+
commandLine: yarn install --frozen-lockfile --global-folder /.yarn
85+
component: runner
86+
workingDir: ${PROJECT_SOURCE}
87+
hotReloadCapable: true
88+
group:
89+
isDefault: true
90+
kind: build
91+
# Run tests in project
92+
- id: test
93+
exec:
94+
commandLine: yarn nx test {{project}}
95+
component: runner
96+
workingDir: ${PROJECT_SOURCE}
97+
group:
98+
isDefault: true
99+
kind: test
100+
# Run development runtime
101+
- id: run
102+
exec:
103+
commandLine: yarn nx serve {{project}} --configuration ${DEPLOY_CONFIG}
104+
component: runner
105+
workingDir: ${PROJECT_SOURCE}
106+
group:
107+
isDefault: true
108+
kind: run
109+
# Deploy image
110+
- id: build-and-deploy-image
111+
apply:
112+
component: image-builder
113+
group:
114+
isDefault: true
115+
kind: deploy
116+
variables:
117+
# Web project to be run, default: landing-page
118+
project: landing-page
119+
# Image tag
120+
imageTag: next
121+
# Profile of the image on quay.io
122+
profile: devfile
123+
# Memory limit on runner, default: 1Gi
124+
memoryLimit: 1Gi
125+
# Deployment configuration to use
126+
deployConfig: development

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@ Thumbs.db
4545
**/*/.env.test.local
4646
**/*/.env.production.local
4747
**/*/__ENV.js
48+
49+
.odo/env
50+
.odo/odo-file-index.json
51+
.odo

.vscode/settings.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"yaml.schemas": {
3-
"https://raw.githubusercontent.com/devfile/api/main/schemas/latest/devfile.json": "devfile.yaml",
4-
"https://json.schemastore.org/github-workflow.json": "file:///c%3A/Programming/Work/devfile-web/.github/workflows/deploy.yml"
3+
"https://raw.githubusercontent.com/devfile/api/v2.2.0/schemas/latest/devfile.json": "devfile.yaml"
54
},
65
"python.linting.pylintEnabled": false,
76
"python.linting.flake8Enabled": true,

apps/landing-page/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"executor": "nx:run-commands",
88
"dependsOn": ["^build"],
99
"options": {
10-
"command": "bash ./scripts/docs.sh > dist/docs.log && yarn react-env --prefix NEXT_PUBLIC --dest ./apps/landing-page/public"
10+
"command": "sh ./scripts/docs.sh > dist/docs.log && yarn react-env --prefix NEXT_PUBLIC --dest ./apps/landing-page/public"
1111
}
1212
},
1313
"build": {

0 commit comments

Comments
 (0)