-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makefile: Implement support for fully sourced container stack HMS-3883
- Loading branch information
1 parent
3af0704
commit d713c92
Showing
10 changed files
with
178 additions
and
7 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 |
---|---|---|
|
@@ -24,3 +24,4 @@ coverage | |
|
||
*~ | ||
bots | ||
container_built.info |
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,36 @@ | ||
|
||
.PHONY: help | ||
help: | ||
@echo "make [TARGETS...]" | ||
@echo | ||
@echo "This is the maintenance makefile of osbuild-composer. The following" | ||
@echo "targets are available:" | ||
@echo | ||
@echo " help: Print this usage information." | ||
@echo " container: Build a container to run the frontend." | ||
@echo " Implicitly used by https://github.com/osbuild/osbuild-getting-started/" | ||
|
||
# either "docker" or "sudo podman" | ||
# podman needs to build as root as it also needs to run as root afterwards | ||
CONTAINER_EXECUTABLE ?= docker | ||
|
||
DOCKER_IMAGE := image-builder-frontend_dev | ||
DOCKERFILE := distribution/Dockerfile.dev | ||
|
||
# All files to check for rebuild! | ||
SRC_DEPS := $(shell find . -not -path './node_modules/*' -not -path './dist/*' -name "*.ts" -or -name "*.tsx" -or -name "*.yml" -or -name "*.yaml" -or -name "*.json" -or -name "*.js") | ||
|
||
clean: | ||
rm -f container_built.info | ||
|
||
container_built.info: $(DOCKERFILE) $(SRC_DEPS) | ||
$(CONTAINER_EXECUTABLE) build -t $(DOCKER_IMAGE) -f $(DOCKERFILE) . --build-arg BUILD_DATE=$(shell date +%Y%m%d_%H%M%S) | ||
echo "Container last built on" > $@ | ||
date >> $@ | ||
|
||
.PHONY: build | ||
build: | ||
npm run build | ||
|
||
.PHONY: container.dev | ||
container.dev: container_built.info |
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 |
---|---|---|
@@ -1,12 +1,22 @@ | ||
FROM node:18 | ||
FROM node:20 | ||
|
||
WORKDIR /app | ||
|
||
ARG BACKEND_HOSTNAME=localhost | ||
ENV BACKEND_HOSTNAME=$BACKEND_HOSTNAME | ||
|
||
ARG BACKEND_PORT=8086 | ||
ENV BACKEND_PORT=$BACKEND_PORT | ||
|
||
COPY . . | ||
|
||
# Helper to re-run npm ci | ||
ARG BUILD_DATE=NOT_SET | ||
ENV BUILD_DATE=$BUILD_DATE | ||
|
||
RUN npm ci | ||
|
||
EXPOSE 8002 | ||
EXPOSE 1337 | ||
|
||
CMD [ "npm", "run", "devel" ] | ||
CMD [ "npm", "run", "start" ] |
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,30 @@ | ||
FROM node:20 | ||
|
||
USER root | ||
# frontend-components need a container system | ||
# this is the reason why we run in docker -> to start podman then | ||
RUN apt update && apt install -y podman | ||
|
||
WORKDIR /app | ||
|
||
ARG BACKEND_HOSTNAME=localhost | ||
ENV BACKEND_HOSTNAME=$BACKEND_HOSTNAME | ||
|
||
ARG BACKEND_PORT=8086 | ||
ENV BACKEND_PORT=$BACKEND_PORT | ||
|
||
COPY . . | ||
|
||
RUN chmod a+x /app/distribution/*.sh | ||
RUN /app/distribution/create_storage_conf.sh | ||
|
||
# Helper to re-run npm ci | ||
ARG BUILD_DATE=NOT_SET | ||
ENV BUILD_DATE=$BUILD_DATE | ||
|
||
RUN npm ci | ||
|
||
EXPOSE 8002 | ||
EXPOSE 1337 | ||
|
||
CMD [ "npm", "run", "start:local" ] |
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,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
mkdir -p /etc/containers | ||
|
||
tee -a /etc/containers/storage.conf <<EOF | ||
[storage] | ||
driver = "vfs" | ||
runroot = "/run/containers/storage" | ||
graphroot = "/var/lib/containers/storage" | ||
EOF |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,58 @@ import { IMAGE_BUILDER_API } from '../constants'; | |
export const emptyImageBuilderApi = createApi({ | ||
reducerPath: 'imageBuilderApi', | ||
baseQuery: fetchBaseQuery({ | ||
baseUrl: window.location.origin + IMAGE_BUILDER_API, | ||
baseUrl: IMAGE_BUILDER_API.startsWith('http') | ||
? IMAGE_BUILDER_API | ||
: window.location.origin + IMAGE_BUILDER_API, | ||
prepareHeaders: (headers) => { | ||
// help the backend distinguish between requests from the UI and the API | ||
headers.set('X-ImageBuilder-ui', 'true'); | ||
if (process.env.FAKE_AUTH) { | ||
const fakeFullEntitlement = `{ | ||
"entitlements": { | ||
"insights": { | ||
"is_entitled": true | ||
}, | ||
"rhel": { | ||
"is_entitled": true | ||
}, | ||
"smart_management": { | ||
"is_entitled": true | ||
}, | ||
"openshift": { | ||
"is_entitled": true | ||
}, | ||
"hybrid": { | ||
"is_entitled": true | ||
}, | ||
"migrations": { | ||
"is_entitled": true | ||
}, | ||
"ansible": { | ||
"is_entitled": true | ||
} | ||
}, | ||
"identity": { | ||
"type": "User", | ||
"user": { | ||
"username": "user", | ||
"email": "[email protected]", | ||
"first_name": "user", | ||
"last_name": "user", | ||
"is_active": true, | ||
"is_org_admin": true, | ||
"is_internal": true, | ||
"locale": "en-US" | ||
}, | ||
"internal": {"org_id": "000000"}, | ||
"account_number": "000000" | ||
} | ||
}`; | ||
headers.set( | ||
'X-Rh-Identity', | ||
Buffer.from(fakeFullEntitlement).toString('base64') | ||
); | ||
} | ||
}, | ||
paramsSerializer: (params) => { | ||
/* | ||
|