Skip to content

Commit 84c09fb

Browse files
committed
UPD
1 parent a9380ea commit 84c09fb

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

.github/workflows/docker-build.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Build and Push Docker Image
22

33
on:
44
push:
5-
branches: [ "*" ] # Todas las branches
5+
branches: [ "*" ]
66
pull_request:
7-
branches: [ "*" ] # PRs a cualquier branch
7+
branches: [ "*" ]
88

99
env:
1010
REGISTRY: ghcr.io
@@ -35,13 +35,9 @@ jobs:
3535
with:
3636
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
3737
tags: |
38-
# Tag con el nombre de la branch
3938
type=ref,event=branch
40-
# Tag con el nombre de la branch del PR
4139
type=ref,event=pr
42-
# Tag latest solo para main/master
4340
type=raw,value=latest,enable={{is_default_branch}}
44-
# Tag con sha del commit
4541
type=sha,prefix={{branch}}-
4642
4743
- name: Set up Docker Buildx
@@ -51,9 +47,14 @@ jobs:
5147
uses: docker/build-push-action@v5
5248
with:
5349
context: .
54-
platforms: linux/amd64,linux/arm64
50+
platforms: linux/amd64 # Solo una arquitectura
5551
push: ${{ github.event_name != 'pull_request' }}
5652
tags: ${{ steps.meta.outputs.tags }}
5753
labels: ${{ steps.meta.outputs.labels }}
58-
cache-from: type=gha
59-
cache-to: type=gha,mode=max
54+
# Cache más agresivo usando registry
55+
cache-from: |
56+
type=gha
57+
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache
58+
cache-to: |
59+
type=gha,mode=max
60+
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache,mode=max

Dockerfile

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
66
# Target arch for wkhtmltopdf
77
ARG TARGETARCH
88

9+
# ===== Copiar requirements.txt primero (para cache) =====
10+
COPY requirements.txt /tmp/requirements.txt
11+
912
# ===== Base deps + wkhtmltopdf =====
1013
RUN apt-get update && \
1114
DEBIAN_FRONTEND=noninteractive \
@@ -34,14 +37,20 @@ RUN apt-get update && \
3437
python3-xlrd \
3538
python3-xlwt \
3639
xz-utils \
37-
# --- extras para AFIP / firmas XML ---
3840
python3-jwt \
3941
libxml2 \
4042
libxmlsec1 \
4143
libxmlsec1-openssl \
4244
build-essential \
4345
python3-dev \
44-
&& if [ -z "${TARGETARCH}" ]; then TARGETARCH="$(dpkg --print-architecture)"; fi \
46+
&& rm -rf /var/lib/apt/lists/*
47+
48+
# ===== Python dependencies (temprano para cache) =====
49+
RUN pip install --no-cache-dir --break-system-packages -r /tmp/requirements.txt \
50+
&& rm /tmp/requirements.txt
51+
52+
# ===== wkhtmltopdf =====
53+
RUN if [ -z "${TARGETARCH}" ]; then TARGETARCH="$(dpkg --print-architecture)"; fi \
4554
&& WKHTMLTOPDF_ARCH=${TARGETARCH} \
4655
&& case ${TARGETARCH} in \
4756
"amd64") WKHTMLTOPDF_ARCH=amd64 && WKHTMLTOPDF_SHA=967390a759707337b46d1c02452e2bb6b2dc6d59 ;; \
@@ -50,6 +59,7 @@ RUN apt-get update && \
5059
esac \
5160
&& curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_${WKHTMLTOPDF_ARCH}.deb \
5261
&& echo ${WKHTMLTOPDF_SHA} wkhtmltox.deb | sha1sum -c - \
62+
&& apt-get update \
5363
&& apt-get install -y --no-install-recommends ./wkhtmltox.deb \
5464
&& rm -rf /var/lib/apt/lists/* wkhtmltox.deb
5565

@@ -80,30 +90,25 @@ RUN curl -o odoo.deb -sSL http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/od
8090
&& apt-get -y install --no-install-recommends ./odoo.deb \
8191
&& rm -rf /var/lib/apt/lists/* odoo.deb
8292

83-
# ===== Python dependencies from requirements.txt =====
84-
COPY requirements.txt /tmp/requirements.txt
85-
RUN pip install --no-cache-dir --break-system-packages -r /tmp/requirements.txt \
86-
&& rm /tmp/requirements.txt \
87-
&& python3 -c "import jwt, pyafipws, pysimplesoap; \
93+
# ===== Verificar instalación =====
94+
RUN python3 -c "import jwt, pyafipws, pysimplesoap; \
8895
print('JWT OK', getattr(jwt,'__version__','unknown')); \
8996
print('pyafipws OK', getattr(pyafipws,'__version__','unknown')); \
9097
print('pysimplesoap OK', getattr(pysimplesoap,'__version__','unknown'))"
9198

92-
# ===== Config y entrypoint =====
99+
# ===== Config y entrypoint (al final para cache) =====
93100
COPY ./entrypoint.sh /
94101
COPY ./odoo.conf /etc/odoo/
102+
COPY wait-for-psql.py /usr/local/bin/wait-for-psql.py
95103

96104
RUN chown odoo /etc/odoo/odoo.conf \
97105
&& mkdir -p /mnt/extra-addons \
98106
&& chown -R odoo /mnt/extra-addons
99107

100108
VOLUME ["/var/lib/odoo", "/mnt/extra-addons"]
101-
102109
EXPOSE 8069 8071 8072
103110
ENV ODOO_RC /etc/odoo/odoo.conf
104111

105-
COPY wait-for-psql.py /usr/local/bin/wait-for-psql.py
106-
107112
USER odoo
108113
ENTRYPOINT ["/entrypoint.sh"]
109114
CMD ["odoo"]

0 commit comments

Comments
 (0)