Skip to content

Commit

Permalink
Makefile: Implement support for fully sourced container stack HMS-3883
Browse files Browse the repository at this point in the history
  • Loading branch information
schuellerf committed Apr 4, 2024
1 parent f71175f commit fc6bd00
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ coverage

*~
bots
container_built.info
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

.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 ?= sudo podman

DOCKER_IMAGE := image-builder-frontend_devel
DOCKERFILE := distribution/Dockerfile

# 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) .
echo "Container last built on" > $@
date >> $@

.PHONY: container
container: container_built.info
6 changes: 5 additions & 1 deletion config/devel.webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ const { config: webpackConfig, plugins } = config({
bounceProd: false,
proxyVerbose: true,
routes: {
'/api/image-builder/v1': { host: 'http://localhost:8086' },
'/api/image-builder/v1': {
host: `http://${process.env.BACKEND_HOSTNAME ?? 'localhost'}:${
process.env.BACKEND_PORT ?? '8086'
}`,
},
},
});

Expand Down
11 changes: 10 additions & 1 deletion distribution/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
# syntax=docker/dockerfile:1.7-labs
FROM node:18

WORKDIR /app

COPY . .
ARG BACKEND_HOSTNAME=localhost
ENV BACKEND_HOSTNAME=$BACKEND_HOSTNAME

ARG BACKEND_PORT=8086
ENV BACKEND_PORT=$BACKEND_PORT

COPY package*.json .

RUN npm ci

COPY --exclude=node_modules/* . .

EXPOSE 8002
EXPOSE 1337

Expand Down

0 comments on commit fc6bd00

Please sign in to comment.