Skip to content

Commit

Permalink
Merge pull request #42 from josejulio/add-build-to-docker
Browse files Browse the repository at this point in the history
Adds build flag to compose calls to prevent stale executions
  • Loading branch information
csams authored Aug 16, 2024
2 parents b6d0fe2 + e1dae2d commit 26354aa
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,19 @@ RUN ln -s /usr/local/go/bin/go /usr/local/bin/go

WORKDIR /workspace

COPY . ./
COPY go.mod go.sum ./

ENV CGO_ENABLED 1
RUN go mod vendor
RUN make build
RUN go mod download

COPY api ./api
COPY cmd ./cmd
COPY internal ./internal
COPY third_party ./third_party
COPY main.go Makefile ./

ARG VERSION
RUN VERSION=${VERSION} make build

FROM registry.access.redhat.com/ubi8/ubi-minimal:8.10

Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ endif
API_PROTO_FILES:=$(shell find api -name *.proto)

TITLE:="Kessel Asset Inventory API"
ifeq ($(VERSION),)
VERSION:=$(shell git describe --tags --always)
endif
INVENTORY_SCHEMA_VERSION=0.11.0

.PHONY: init
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
# - "INVENTORY_API_STORAGE_POSTGRES_PASSWORD=${POSTGRES_PASSWORD}"
build:
dockerfile: Dockerfile
args:
VERSION: dev
volumes:
- ./inventory-api-compose.yaml:/inventory-api-compose.yaml:ro,z
- ./config/psks.yaml:/psks.yaml:ro,z
Expand All @@ -22,6 +24,8 @@ services:
INVENTORY_API_CONFIG: /inventory-api-compose.yaml
build:
dockerfile: Dockerfile
args:
VERSION: dev
volumes:
- ./inventory-api-compose.yaml:/inventory-api-compose.yaml:ro,z
command: ["migrate"]
Expand Down
2 changes: 1 addition & 1 deletion scripts/start-inventory-kc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -e
# Function to check if a command is available
source ./scripts/check_docker_podman.sh
${DOCKER} compose --env-file ./scripts/.env -f ./docker-compose-sso.yaml up -d
${DOCKER} compose --env-file ./scripts/.env -f ./docker-compose-sso.yaml up -d --build
2 changes: 1 addition & 1 deletion scripts/start-inventory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -e
# Function to check if a command is available
source ./scripts/check_docker_podman.sh
${DOCKER} compose --env-file ./scripts/.env -f ./docker-compose.yaml up -d
${DOCKER} compose --env-file ./scripts/.env -f ./docker-compose.yaml up -d --build

0 comments on commit 26354aa

Please sign in to comment.