docker-compose and docker files

This commit is contained in:
2026-01-18 08:27:51 -05:00
parent 65b91df22c
commit ec07e5a0c8
3 changed files with 28 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
# Stage 1: Build the application (The Build Stage)
# Use a Java SDK image with Maven pre-installed
FROM maven:3.9-jdk-17-slim AS build
FROM maven:3.9.6-eclipse-temurin-21 AS build
# Set the working directory inside the container
WORKDIR /app
@@ -17,8 +17,9 @@ RUN mvn clean package -DskipTests
# Stage 2: Create the final lightweight image (The Runtime Stage)
# Use a smaller Java Runtime Environment (JRE) image for a smaller footprint
FROM openjdk:17-jre-slim
FROM eclipse-temurin:21-jre
ENV SPRING_PROFILES_ACTIVE=prod
# Set the working directory in the final image
WORKDIR /app

View File

@@ -14,6 +14,7 @@ services:
- SPRING_DATASOURCE_URL=jdbc:postgresql://r710.dev.gofwd.group:5433/ss_builder
- SPRING_DATASOURCE_USERNAME=dba
- SPRING_DATASOURCE_PASSWORD=!@#Qwerty
- SPRING_PROFILES_ACTIVE=prod
networks:
- app-network

24
push-image.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -e
REGISTRY="gitea.gofwd.group"
OWNER="forward_group/ballistic-builder-spring"
IMAGE="spring-api"
TAG=$(git rev-parse --short HEAD)
FULL_IMAGE="$REGISTRY/$OWNER/$IMAGE"
echo "Building $FULL_IMAGE:$TAG"
docker build -f docker/backend/Dockerfile -t $FULL_IMAGE:$TAG .
echo "Tagging latest"
docker tag $FULL_IMAGE:$TAG $FULL_IMAGE:latest
echo "Pushing $TAG"
docker push $FULL_IMAGE:$TAG
echo "Pushing latest"
docker push $FULL_IMAGE:latest
echo "Done!"