Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve docker layers to pull with cache. #5

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
file: docker/Dockerfile.alpine
file: docker/alpine.Dockerfile
push: true
tags: |
${{ secrets.DOCKER_HUB_REPO_NAME }}:alpine-${{ github.event.release.tag_name }}
Expand Down Expand Up @@ -213,7 +213,7 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
file: docker/alpine.Dockerfile
platforms: linux/amd64,linux/amd64/v2,linux/arm64/v8
push: true
tags: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ To use this Docker image you must have your Docker engine version greater than o
* `SERVER_PORT`: Port to access Adempiere-Backend from outside of the container. Default: `50059`.
* `SERVER_LOG_LEVEL`: Log Level. Default: `WARNING`.
* `TZ`: (Time Zone) Indicates the time zone to set in the nginx-based container, the default value is `America/Caracas` (UTC -4:00).
* `SYSTEM_LOGO_URL`: Logo of the main image of the system, shown in the login screen.
* `JAVA_OPTIONS`: Custom settings to the Java Virtual Machine (JVM). Default: `-Xms64M -Xmx1512M`.

You can download the last image from docker hub, just run the follow command:

Expand Down
40 changes: 22 additions & 18 deletions docker/Dockerfile.alpine → docker/alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM eclipse-temurin:11-jdk-alpine
FROM eclipse-temurin:11.0.24_8-jdk-alpine

LABEL maintainer="[email protected]; [email protected];" \
description="ADempiere Processors gRPC"

# Init ENV with default values
ENV \
Expand All @@ -17,32 +20,34 @@ ENV \
MAXIMUM_LIFETIME="6000" \
KEEPALIVE_TIME="360000" \
CONNECTION_TEST_QUERY="\"SELECT 1\"" \
SYSTEM_LOGO_URL="" \
JAVA_OPTIONS="\"-Xms64M\" \"-Xmx1512M\"" \
TZ="America/Caracas"

WORKDIR /opt/apps/server

# Copy src files
COPY docker/adempiere-processors-service /opt/apps/server
COPY docker/env.yaml /opt/apps/server/env.yaml
COPY docker/start.sh /opt/apps/server/start.sh

EXPOSE ${SERVER_PORT}


# Add operative system dependencies
RUN rm -rf /var/cache/apk/* && \
rm -rf /tmp/* && \
apk update && \
RUN apk update && \
apk add --no-cache \
tzdata \
bash \
fontconfig \
fontconfig \
ttf-dejavu && \
echo "Set Timezone..." && \
echo $TZ > /etc/timezone && \
apk add --no-cache \
tzdata
rm -rf /var/cache/apk/* && \
rm -rf /tmp/* && \
echo "Set Timezone..." && \
echo $TZ > /etc/timezone


WORKDIR /opt/apps/server

# Copy src files
COPY docker/adempiere-processors-service /opt/apps/server
COPY docker/env.yaml /opt/apps/server/env.yaml
COPY docker/start.sh /opt/apps/server/start.sh


# Add adempiere as user
RUN addgroup adempiere && \
adduser --disabled-password --gecos "" --ingroup adempiere --no-create-home adempiere && \
chown -R adempiere /opt/apps/server/ && \
Expand All @@ -52,4 +57,3 @@ USER adempiere

# Start app
ENTRYPOINT ["sh" , "start.sh"]

36 changes: 22 additions & 14 deletions docker/Dockerfile → docker/focal.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM eclipse-temurin:11-jdk-focal
FROM eclipse-temurin:11.0.24_8-jdk-focal

LABEL maintainer="[email protected]; [email protected];" \
description="ADempiere Processors gRPC"

# Init ENV with default values
ENV \
Expand All @@ -17,28 +20,34 @@ ENV \
MAXIMUM_LIFETIME="6000" \
KEEPALIVE_TIME="360000" \
CONNECTION_TEST_QUERY="\"SELECT 1\"" \
SYSTEM_LOGO_URL="" \
JAVA_OPTIONS="\"-Xms64M\" \"-Xmx1512M\"" \
TZ="America/Caracas"

EXPOSE ${SERVER_PORT}


# Add operative system dependencies
RUN apt-get update && \
apt-get install -y \
tzdata \
bash \
fontconfig \
ttf-dejavu && \
rm -rf /var/lib/apt/lists/* \
rm -rf /tmp/* && \
echo "Set Timezone..." && \
echo $TZ > /etc/timezone


WORKDIR /opt/apps/server

# Copy src files
COPY docker/adempiere-processors-service /opt/apps/server
COPY docker/env.yaml /opt/apps/server/env.yaml
COPY docker/start.sh /opt/apps/server/start.sh

EXPOSE ${SERVER_PORT}


# Add operative system dependencies
RUN apt-get update && apt-get install -y tzdata \
bash \
fontconfig \
ttf-dejavu && \
rm -rf /var/lib/apt/lists/* \
echo "Set Timezone..." && \
echo $TZ > /etc/timezone

# Add adempiere as user
RUN addgroup adempiere && \
adduser --disabled-password --gecos "" --ingroup adempiere --no-create-home adempiere && \
chown -R adempiere /opt/apps/server/ && \
Expand All @@ -48,4 +57,3 @@ USER adempiere

# Start app
ENTRYPOINT ["sh" , "start.sh"]

4 changes: 3 additions & 1 deletion docker/start.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env sh
# @autor Yamel Senih <[email protected]>
# @autor Edwin Betancourt <[email protected]> https://github.com/EdwinBetanc0urt

# Set server values
sed -i "s|50059|$SERVER_PORT|g" env.yaml
sed -i "s|WARNING|$SERVER_LOG_LEVEL|g" env.yaml

export DEFAULT_JAVA_OPTIONS='"-Xms64M" "-Xmx1512M"'

# Set data base conection values
sed -i "s|adempiere_database_host|$DB_HOST|g" env.yaml
sed -i "s|5432|$DB_PORT|g" env.yaml
Expand All @@ -20,7 +22,7 @@ sed -i "s|fill_connection_timeout|$CONNECTION_TIMEOUT|g" env.yaml
sed -i "s|fill_maximum_lifetime|$MAXIMUM_LIFETIME|g" env.yaml
sed -i "s|fill_keepalive_time|$KEEPALIVE_TIME|g" env.yaml
sed -i "s|fill_connection_test_query|$CONNECTION_TEST_QUERY|g" env.yaml
sed -i "s|$DEFAULT_JAVA_OPTIONS|$GRPC_JAVA_OPTIONS|g" bin/adempiere-processors-service-server
sed -i "s|$DEFAULT_JAVA_OPTIONS|$JAVA_OPTIONS|g" bin/adempiere-processors-service-server

# Run app
bin/adempiere-processors-service-server env.yaml
Loading