diff --git a/.dockerignore b/.dockerignore index 49bd426..bc0dc3f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,7 @@ target node_modules -Dockerfile +Podmanfile .dockerignore docker-compose.prod.yml Makefile diff --git a/Cargo.toml b/Cargo.toml index 98249a8..733ffdc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "kompress_eshop" -version = "0.1.0" +version = "0.5.0" edition = "2024" publish = false default-run = "kompress-eshop-cli" diff --git a/Makefile b/Makefile index 020e157..a33393a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ -COMPOSE = docker compose -f docker-compose.prod.yml --env-file .env.production +COMPOSE ?= docker compose -f docker-compose.prod.yml --env-file .env.production +PODMAN_COMPOSE ?= podman compose -f podman-compose.prod.yml --env-file .env.production # --- Frontend (Tailwind v4 + PenguinUI) ----------------------------- # Uses the Tailwind v4 standalone binary (no Node required at runtime). @@ -13,7 +14,7 @@ else TW_TARGET = tailwindcss-linux-x64 endif -.PHONY: up down restart logs build ps css css-watch tailwind +.PHONY: up down restart logs build ps podman-up podman-down podman-restart podman-logs podman-build podman-ps css css-watch tailwind $(TW): @mkdir -p bin @@ -45,3 +46,20 @@ build: ps: $(COMPOSE) ps + +podman-up: + $(PODMAN_COMPOSE) up -d --build + +podman-down: + $(PODMAN_COMPOSE) down + +podman-restart: podman-down podman-up + +podman-logs: + $(PODMAN_COMPOSE) logs -f --tail=100 + +podman-build: + $(PODMAN_COMPOSE) build --no-cache + +podman-ps: + $(PODMAN_COMPOSE) ps diff --git a/Dockerfile b/Podmanfile similarity index 68% rename from Dockerfile rename to Podmanfile index e56cf59..cf9b038 100644 --- a/Dockerfile +++ b/Podmanfile @@ -5,7 +5,7 @@ WORKDIR /usr/src COPY . . -RUN cargo build --release --bin kompress-cli +RUN cargo build --release --bin kompress-eshop-cli FROM debian:bookworm-slim @@ -17,9 +17,9 @@ WORKDIR /usr/app COPY --from=builder /usr/src/assets assets COPY --from=builder /usr/src/config config -COPY --from=builder /usr/src/target/release/kompress-cli kompress-cli +COPY --from=builder /usr/src/target/release/kompress-eshop-cli kompress-eshop-cli ENV LOCO_ENV=production EXPOSE 5150 -ENTRYPOINT ["/usr/app/kompress-cli"] +ENTRYPOINT ["/usr/app/kompress-eshop-cli"] CMD ["start"] diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index e227687..324065b 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -3,7 +3,7 @@ services: container_name: kompress build: context: . - dockerfile: Dockerfile + dockerfile: Podmanfile extra_hosts: - "host.docker.internal:host-gateway" env_file: diff --git a/podman-compose.prod.yml b/podman-compose.prod.yml new file mode 100644 index 0000000..6d4e89c --- /dev/null +++ b/podman-compose.prod.yml @@ -0,0 +1,28 @@ +services: + kompress: + container_name: kompress + build: + context: . + dockerfile: Podmanfile + env_file: + - .env.production + volumes: + - kompress_eshop_data:/usr/app/data + networks: + - kompress_eshop-net + restart: unless-stopped + healthcheck: + test: ["CMD-SHELL", "curl -fsS http://localhost:5150/_ping"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 20s + +networks: + kompress_eshop-net: + external: true + +volumes: + kompress_eshop_data: + external: true + name: kompress_eshop_data