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

Uiv1 general #22

Merged
merged 2 commits into from
Aug 24, 2022
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
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.dockerignore
README.md

**/.next
**/Dockerfile
**/build/
**/yarn-error.log
**/.gitignore

# Envs
**/.env.local
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.idea/

#dependencies
node_modules

Expand Down
3 changes: 3 additions & 0 deletions .lagoon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docker-compose-yaml: docker-compose.yml

project: lagoon-ui
42 changes: 21 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
ARG LAGOON_GIT_BRANCH
ARG IMAGE_REPO
ARG UPSTREAM_REPO
ARG UPSTREAM_TAG
# STAGE 1: Loading Image lagoon-node-packages-builder which contains node packages shared by all Node Services
FROM ${IMAGE_REPO:-lagoon}/yarn-workspace-builder as yarn-workspace-builder
# Node builder image
FROM uselagoon/node-16-builder:latest as builder

# STAGE 2: specific service Image
FROM ${UPSTREAM_REPO:-uselagoon}/node-16:${UPSTREAM_TAG:-latest}
COPY . /app/

ARG LAGOON_VERSION
ENV LAGOON_VERSION=$LAGOON_VERSION
RUN yarn install

# Copying generated node_modules from the first stage
COPY --from=yarn-workspace-builder /app /app

# Setting the workdir to the service, all following commands will run from here
WORKDIR /app/services/ui/
# Node service image
FROM uselagoon/node-16:latest

# Copying the .env.defaults into the Workdir, as the dotenv system searches within the workdir for it
COPY --from=yarn-workspace-builder /app/.env.defaults .
ARG LAGOON_VERSION
ENV LAGOON_VERSION=$LAGOON_VERSION

# Copying files from our service
COPY . .
# Copy the node_modules from node builder
COPY --from=builder /app/node_modules /app/node_modules

# Verify that all dependencies have been installed via the yarn-workspace-builder
RUN yarn check --verify-tree
# Copying files from ui service
COPY . /app/

# Making sure we run in production
ENV NODE_ENV=production

ARG KEYCLOAK_API
ENV KEYCLOAK_API=$KEYCLOAK_API

ARG GRAPHQL_API
ENV GRAPHQL_API=$GRAPHQL_API

# Build app
RUN yarn run build

CMD ["yarn", "start"]
EXPOSE 3000
CMD ["yarn", "start"]
44 changes: 44 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: '3.2'

x-lagoon-project:
# Lagoon project name (leave `&lagoon-project` when you edit this)
&lagoon-project lagoon-ui

x-environment: &default-environment
LAGOON_PROJECT: *lagoon-project
# Route that should be used locally, if you are using pygmy, this route *must* end with .docker.amazee.io
LAGOON_ROUTE: &default-url http://lagoon-ui.docker.amazee.io
# Uncomment if you like to have the system behave like in production
LAGOON_ENVIRONMENT_TYPE: production
GRAPHQL_API: "${GRAPHQL_API:-http://localhost:3000/graphql}"
KEYCLOAK_API: "${KEYCLOAK_API:-http://localhost:8088/auth}"

services:
ui:
build:
context: .
dockerfile: .lagoon/ui.Dockerfile
labels:
lagoon.type: node
depends_on:
- 'api-db'
- 'api'
command: yarn run start
volumes:
- ./services/ui/src:/app/src
- ./services/ui/.env.defaults:/app/.env.defaults
- ./services/ui/.env.schema:/app/.env.schema
- ./services/ui/package.json:/app/package.json
- ./services/ui/api-db-seeding:/app/api-db-seeding
ports:
- '8888:3000'
- '3003:3003'
networks:
- amazeeio-network
- default
environment:
<<: *default-environment

networks:
amazeeio-network:
external: true
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
"d3": "^5.15.0",
"date-fns": "^2.9.0",
"dotenv-extended": "^2.2.0",
"express": "^4.16.4",
"express": "^4.18.1",
"git-url-parse": "^11.1.2",
"graphql": "^14.5.8",
"graphql-tag": "^2.10.0",
"isomorphic-unfetch": "^2.1.1",
"moment": "^2.22.2",
"moment-duration-format": "^2.2.2",
"next": "^8.0.3",
"object-hash": "^3.0.0",
"postcss-nested": "^3.0.0",
"ramda": "^0.25.0",
"react": "^16.8.4",
Expand All @@ -52,7 +53,9 @@
"recompose": "^0.30.0",
"resize-observer-polyfill": "^1.5.1",
"styled-jsx-plugin-postcss": "^0.1.3",
"subscriptions-transport-ws": "^0.11.0",
"svg-inline-loader": "^0.8.0",
"typescript": "^4.7.4",
"webpack": "^4.41.2"
},
"devDependencies": {
Expand Down
6 changes: 6 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ app
});
});

server.get('/projects/:projectSlug/:environmentSlug/insights', (req, res) => {
app.render(req, res, '/insights', {
openshiftProjectName: req.params.environmentSlug
});
});

server.get('*', (req, res) => {
return handle(req, res);
});
Expand Down
Loading