Compare commits
2 Commits
2a7fe41b0b
...
afcbcbaf12
| Author | SHA1 | Date | |
|---|---|---|---|
| afcbcbaf12 | |||
| e97864a251 |
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@ -0,0 +1,8 @@
|
||||
target/
|
||||
.git/
|
||||
.gitignore
|
||||
.idea/
|
||||
.vscode/
|
||||
**/*.iml
|
||||
secrets/
|
||||
.env
|
||||
29
.drone.yml
Normal file
29
.drone.yml
Normal file
@ -0,0 +1,29 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: debug registry secrets
|
||||
image: alpine
|
||||
environment:
|
||||
USERNAME:
|
||||
from_secret: docker_username
|
||||
PASSWORD:
|
||||
from_secret: docker_password
|
||||
TEST:
|
||||
from_secret: test
|
||||
commands:
|
||||
- echo $TEST
|
||||
- echo $USERNAME
|
||||
- echo $PASSWORD
|
||||
|
||||
- name: build and push electricityalert image
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: rubble.se:5000/urmo/electricityalert
|
||||
registry: rubble.se:5000
|
||||
tags: latest
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
38
Dockerfile
Normal file
38
Dockerfile
Normal file
@ -0,0 +1,38 @@
|
||||
# -------- Build stage --------
|
||||
FROM maven:3.9.9-eclipse-temurin-21 AS build
|
||||
WORKDIR /app
|
||||
|
||||
# Cache dependencies
|
||||
COPY pom.xml .
|
||||
RUN mvn -q -DskipTests dependency:go-offline
|
||||
|
||||
# Build
|
||||
COPY src ./src
|
||||
RUN mvn -q -DskipTests package
|
||||
|
||||
# -------- Runtime stage --------
|
||||
FROM eclipse-temurin:21-jre-jammy
|
||||
|
||||
# Timezone & JVM defaults
|
||||
ENV TZ=Europe/Stockholm
|
||||
# Ensure JVM uses Stockholm time regardless of container TZ config
|
||||
ENV JAVA_TOOL_OPTIONS="-Duser.timezone=Europe/Stockholm"
|
||||
# Sensible container-aware memory settings (tweak as you like)
|
||||
ENV JAVA_OPTS="-XX:MaxRAMPercentage=75"
|
||||
|
||||
# Non-root user
|
||||
RUN useradd -ms /bin/bash spring
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/target/electricityalert-*.jar /app/app.jar
|
||||
RUN chown -R spring:spring /app
|
||||
USER spring
|
||||
|
||||
# App port
|
||||
EXPOSE 8080
|
||||
|
||||
# Spring profile can be overridden at runtime: -e SPRING_PROFILES_ACTIVE=prod
|
||||
ENV SPRING_PROFILES_ACTIVE=prod
|
||||
|
||||
# Pass secrets as env vars (see your application.properties)
|
||||
# -e TELEGRAM_BOT_TOKEN=... -e TELEGRAM_CHAT_ID=... -e GRAPHQL_ACCESS_TOKEN=...
|
||||
ENTRYPOINT ["sh","-c","java $JAVA_OPTS -jar /app/app.jar"]
|
||||
Reference in New Issue
Block a user