add docker file and build script
All checks were successful
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (push) Successful in 12s
checks / Set up Java for Backend Tests and Build (push) Successful in 15s
Gitea Actions Demo / Explore-Gitea-Actions-2 (pull_request) Successful in 3s
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (pull_request) Successful in 12s
checks / Set up Java for Backend Tests and Build (pull_request) Successful in 11s
All checks were successful
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (push) Successful in 12s
checks / Set up Java for Backend Tests and Build (push) Successful in 15s
Gitea Actions Demo / Explore-Gitea-Actions-2 (pull_request) Successful in 3s
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (pull_request) Successful in 12s
checks / Set up Java for Backend Tests and Build (pull_request) Successful in 11s
This commit is contained in:
@ -74,6 +74,7 @@ jobs:
|
||||
frontend-${{ runner.os }}-yarn-
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn build
|
||||
#yarn test --watchAll=false --ci
|
||||
|
||||
#Check frontend linting
|
||||
|
||||
47
Dockerfile
Normal file
47
Dockerfile
Normal file
@ -0,0 +1,47 @@
|
||||
# ===== Stage 1: Build with Maven =====
|
||||
FROM eclipse-temurin:21-jdk-alpine AS builder
|
||||
|
||||
ARG MAVEN_VERSION=3.9.9
|
||||
ENV MAVEN_HOME=/opt/maven
|
||||
ENV PATH=${MAVEN_HOME}/bin:${PATH}
|
||||
|
||||
# Install required tools quietly and set up Maven
|
||||
RUN set -eux; \
|
||||
apk add --no-cache curl tar bash openssl >/dev/null; \
|
||||
echo "Downloading Maven ${MAVEN_VERSION}..."; \
|
||||
curl -fsSL "https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz" -o /tmp/maven.tar.gz; \
|
||||
mkdir -p /opt >/dev/null; \
|
||||
tar -xzf /tmp/maven.tar.gz -C /opt >/dev/null; \
|
||||
ln -s /opt/apache-maven-${MAVEN_VERSION} ${MAVEN_HOME}; \
|
||||
rm /tmp/maven.tar.gz; \
|
||||
echo "✅ Maven ${MAVEN_VERSION} installed successfully."
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Copy pom.xml and prefetch dependencies silently
|
||||
COPY pom.xml .
|
||||
RUN mvn -B -q dependency:go-offline
|
||||
|
||||
# Copy source code
|
||||
COPY src ./src
|
||||
|
||||
# Build project (skip tests, quiet mode)
|
||||
RUN mvn -B -q clean package -DskipTests
|
||||
|
||||
# ===== Stage 2: Runtime image =====
|
||||
FROM eclipse-temurin:21-jre-alpine
|
||||
|
||||
RUN addgroup -S spring && adduser -S spring -G spring
|
||||
USER spring:spring
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /build/target/*.jar app.jar
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
# Optional: Health check (Spring Boot actuator)
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
|
||||
CMD wget -qO- http://localhost:8080/actuator/health | grep '"status":"UP"' || exit 1
|
||||
|
||||
ENTRYPOINT ["java", "-XX:+UseContainerSupport", "-XX:MaxRAMPercentage=75.0", "-jar", "app.jar"]
|
||||
8
build-image.sh
Normal file
8
build-image.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#! /bin/bash
|
||||
set -e # Exit immediately if a command exits with a non-zero status
|
||||
|
||||
export $(grep -v '^#' C:/atrizult/projects/.env | xargs)
|
||||
|
||||
#Build
|
||||
docker buildx build --no-cache -t eberen/services:backend-${VERSION} .
|
||||
echo "Docker Image Built Successfully"
|
||||
Reference in New Issue
Block a user