-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(build): add full dockerfile containing yarn step (#187)
* chore(build): add full dockerfile containing yarn step We can create images without yarn installed and this change streamlines dockerfiles across portal repositories. * Rename existing dockerfile and update references in workflows * Add comments to dockerfile to describe purpose.
- Loading branch information
1 parent
989a572
commit b474d88
Showing
7 changed files
with
62 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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,53 @@ | ||
############################################################### | ||
# Copyright (c) 2024 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 governing permissions and limitations | ||
# under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
############################################################### | ||
|
||
# | ||
# Dockerfile with full build after checkout | ||
# | ||
|
||
# Step 1 | ||
FROM node:21-alpine as build-step | ||
ARG http_proxy=$http_proxy | ||
ARG https_proxy=$https_proxy | ||
ARG no_proxy=$no_proxy | ||
RUN apk update && apk add --no-cache jq | ||
COPY . /app | ||
WORKDIR /app | ||
RUN yarn | ||
RUN yarn build | ||
|
||
# Step 2 | ||
FROM nginxinc/nginx-unprivileged:alpine | ||
COPY .conf/nginx.conf /etc/nginx/conf.d/default.conf | ||
COPY --from=build-step /app/build /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 | ||
# Install bash for env variables inject script | ||
RUN apk update && apk add --no-cache bash | ||
# 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 |
This file contains 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 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 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 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 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 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