-
Notifications
You must be signed in to change notification settings - Fork 18
First Dockerfile version for frontend #113
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
Closed
pjuaristi-ikerlan
wants to merge
9
commits into
eclipse-tractusx:main
from
pjuaristi-ikerlan:dockerfile
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
54e7698
fix: errors in build fixed
pjuaristi-ikerlan d0b318f
fix: dropdown button icon removed
pjuaristi-ikerlan 59a8a75
chore: custom palette variables included
pjuaristi-ikerlan 208cf85
feat: first version of Dockerfile
pjuaristi-ikerlan 03a79ae
fix: theme reestructurated to reduce build problems
pjuaristi-ikerlan f345613
fix: chip colors overriding to fix all build problems
pjuaristi-ikerlan b49b69c
chore: backend api data commented for now in nginx configuration
pjuaristi-ikerlan c9f16a2
feat: Dynamic env variable injection
pjuaristi-ikerlan 71c72b7
Merge branch 'eclipse-tractusx:main' into dockerfile
pjuaristi-ikerlan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
################################################################################# | ||
# Eclipse Tractus-X - Industry Core Hub Frontend | ||
# | ||
# Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
# | ||
# See the NOTICE file(s) distributed with this work for additional | ||
# information regarding copyright ownership. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Apache License, Version 2.0 which is available at | ||
# https://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
# either express or implied. See the | ||
# License for the specific language govern in permissions and limitations | ||
# under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
################################################################################# | ||
|
||
# Stage 1: Build the React app | ||
FROM node:23-alpine AS builder | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Install necessary dependencies | ||
RUN apk add --no-cache python3 make g++ jq | ||
|
||
# Copy package files and install dependencies | ||
COPY package.json yarn.lock ./ | ||
RUN yarn install --frozen-lockfile | ||
|
||
# Copy the rest of the source code | ||
COPY . . | ||
|
||
# Build the application | ||
RUN yarn build | ||
|
||
|
||
# Stage 2: Serve the app with Nginx | ||
FROM nginxinc/nginx-unprivileged:alpine | ||
Check noticeCode scanning / KICS Healthcheck Instruction Missing Note
Dockerfile doesn't contain instruction 'HEALTHCHECK'
|
||
|
||
# Copy custom Nginx configuration | ||
COPY nginx.conf /etc/nginx/conf.d/default.conf | ||
|
||
# Copy built files from the builder stage | ||
COPY --from=builder /app/dist /usr/share/nginx/html | ||
|
||
# Change to root user | ||
USER root | ||
|
||
# Rename index.html to index.html.reference, to be used by env variables inject script | ||
RUN mv /usr/share/nginx/html/index.html /usr/share/nginx/html/index.html.reference | ||
|
||
# Create symlink for tmp for index.html to enable readOnlyRootFilesystem | ||
RUN ln -s /tmp/index.html /usr/share/nginx/html/index.html | ||
|
||
# Add env variables inject script and mark as executable | ||
COPY ./scripts/inject-dynamic-env.sh /docker-entrypoint.d/00-inject-dynamic-env.sh | ||
RUN chmod +x /docker-entrypoint.d/00-inject-dynamic-env.sh | ||
|
||
# Make nginx owner of /usr/share/nginx/html/ and change to nginx user | ||
RUN chown -R 101:101 /usr/share/nginx/html/ | ||
|
||
# Change to nginx user | ||
USER 101 | ||
|
||
# Expose port 80 | ||
EXPOSE 80 | ||
|
||
# Start Nginx | ||
CMD ["nginx", "-g", "daemon off;"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
################################################################################# | ||
# Eclipse Tractus-X - Industry Core Hub Frontend | ||
# | ||
# Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
# | ||
# See the NOTICE file(s) distributed with this work for additional | ||
# information regarding copyright ownership. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Apache License, Version 2.0 which is available at | ||
# https://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
# either express or implied. See the | ||
# License for the specific language govern in permissions and limitations | ||
# under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
################################################################################# | ||
|
||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
try_files $uri $uri/index.html /index.html; | ||
} | ||
|
||
error_page 404 /index.html; | ||
|
||
# Here we should specify the backend service | ||
# location /api/ { | ||
# proxy_pass http://backend:5000/; | ||
# proxy_set_header Host $host; | ||
# proxy_set_header X-Real-IP $remote_addr; | ||
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
# } | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh | ||
|
||
################################################################################# | ||
# Eclipse Tractus-X - Industry Core Hub Frontend | ||
# | ||
# Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
# | ||
# See the NOTICE file(s) distributed with this work for additional | ||
# information regarding copyright ownership. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Apache License, Version 2.0 which is available at | ||
# https://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
# either express or implied. See the | ||
# License for the specific language govern in permissions and limitations | ||
# under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
################################################################################# | ||
|
||
source_file=/usr/share/nginx/html/index.html.reference | ||
target_file=/tmp/index.html | ||
|
||
# List of environment variables to be replaced | ||
# (They should be set and match the ones in index.html) | ||
# Sequence is irrelevant | ||
vars=" \ | ||
REQUIRE_HTTPS_URL_PATTERN \ | ||
ICHUB_ASSETS_URL \ | ||
ICHUB_BACKEND_URL \ | ||
" | ||
|
||
# Execute envsubst with the defined variables | ||
envsubst "$(printf '${%s} ' $vars)" < "$source_file" > "$target_file" | ||
|
||
echo "Variables injected correctly in $target_file" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / KICS
Unpinned Package Version in Apk Add Warning