2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-11-08 14:21:05 +00:00

feat: allow custom git repos (#771)

fixes #770
This commit is contained in:
Revant Nandgaonkar 2022-04-11 10:30:16 +05:30 committed by GitHub
parent bc915f7b34
commit 5edac4c12a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 6 deletions

View File

@ -13,9 +13,24 @@ variable "ERPNEXT_VERSION" {
default = "develop" default = "develop"
} }
variable "FRAPPE_REPO" {
default = "https://github.com/frappe/frappe"
}
variable "ERPNEXT_REPO" {
default = "https://github.com/frappe/erpnext"
}
variable "BENCH_REPO" {
default = "https://github.com/frappe/bench"
}
# Bench image # Bench image
target "bench" { target "bench" {
args = {
GIT_REPO = "${BENCH_REPO}"
}
context = "images/bench" context = "images/bench"
target = "bench" target = "bench"
tags = ["frappe/bench:latest"] tags = ["frappe/bench:latest"]
@ -53,6 +68,9 @@ function "tag" {
target "default-args" { target "default-args" {
args = { args = {
FRAPPE_REPO = "${FRAPPE_REPO}"
ERPNEXT_REPO = "${ERPNEXT_REPO}"
BENCH_REPO = "${BENCH_REPO}"
FRAPPE_VERSION = "${FRAPPE_VERSION}" FRAPPE_VERSION = "${FRAPPE_VERSION}"
ERPNEXT_VERSION = "${ERPNEXT_VERSION}" ERPNEXT_VERSION = "${ERPNEXT_VERSION}"
# If `ERPNEXT_VERSION` variable contains "v12" use Python 3.7. Else  3.9. # If `ERPNEXT_VERSION` variable contains "v12" use Python 3.7. Else  3.9.

View File

@ -14,8 +14,9 @@ RUN mkdir -p sites/assets /out/assets \
&& echo frappe >sites/apps.txt && echo frappe >sites/apps.txt
ARG FRAPPE_VERSION ARG FRAPPE_VERSION
ARG FRAPPE_REPO=https://github.com/frappe/frappe
# Install development node modules # Install development node modules
RUN git clone --depth 1 -b ${FRAPPE_VERSION} https://github.com/frappe/frappe apps/frappe \ RUN git clone --depth 1 -b ${FRAPPE_VERSION} ${FRAPPE_REPO} apps/frappe \
&& yarn --cwd apps/frappe \ && yarn --cwd apps/frappe \
# TODO: Currently `yarn run production` doesn't create .build on develop branch: https://github.com/frappe/frappe/issues/15396 # TODO: Currently `yarn run production` doesn't create .build on develop branch: https://github.com/frappe/frappe/issues/15396
&& if [ ! -f sites/.build ]; then touch sites/.build; fi \ && if [ ! -f sites/.build ]; then touch sites/.build; fi \
@ -32,14 +33,16 @@ RUN install-app frappe
FROM assets_builder as erpnext_assets FROM assets_builder as erpnext_assets
ARG ERPNEXT_VERSION ARG ERPNEXT_VERSION
RUN git clone --depth 1 -b ${ERPNEXT_VERSION} https://github.com/frappe/erpnext apps/erpnext \ ARG ERPNEXT_REPO=https://github.com/frappe/erpnext
RUN git clone --depth 1 -b ${ERPNEXT_VERSION} ${ERPNEXT_REPO} apps/erpnext \
&& install-app erpnext && install-app erpnext
FROM alpine/git as bench FROM alpine/git as bench
# Error pages # Error pages
RUN git clone --depth 1 https://github.com/frappe/bench /tmp/bench \ ARG BENCH_REPO=https://github.com/frappe/bench
RUN git clone --depth 1 ${BENCH_REPO} /tmp/bench \
&& mkdir /out \ && mkdir /out \
&& mv /tmp/bench/bench/config/templates/502.html /out/ && mv /tmp/bench/bench/config/templates/502.html /out/

View File

@ -1,7 +1,8 @@
FROM alpine/git as builder FROM alpine/git as builder
ARG FRAPPE_VERSION ARG FRAPPE_VERSION
RUN git clone --depth 1 -b ${FRAPPE_VERSION} https://github.com/frappe/frappe /opt/frappe ARG FRAPPE_REPO=https://github.com/frappe/frappe
RUN git clone --depth 1 -b ${FRAPPE_VERSION} ${FRAPPE_REPO} /opt/frappe
FROM node:17-alpine FROM node:17-alpine

View File

@ -42,8 +42,9 @@ RUN apt-get update \
FROM build_deps as frappe_builder FROM build_deps as frappe_builder
ARG FRAPPE_VERSION ARG FRAPPE_VERSION
ARG FRAPPE_REPO=https://github.com/frappe/frappe
RUN --mount=type=cache,target=/root/.cache/pip \ RUN --mount=type=cache,target=/root/.cache/pip \
git clone --depth 1 -b ${FRAPPE_VERSION} https://github.com/frappe/frappe apps/frappe \ git clone --depth 1 -b ${FRAPPE_VERSION} ${FRAPPE_REPO} apps/frappe \
&& install-app frappe \ && install-app frappe \
&& env/bin/pip install -U gevent \ && env/bin/pip install -U gevent \
# Link Frappe's node_modules/ to make Website Theme work # Link Frappe's node_modules/ to make Website Theme work
@ -54,8 +55,9 @@ RUN --mount=type=cache,target=/root/.cache/pip \
FROM frappe_builder as erpnext_builder FROM frappe_builder as erpnext_builder
ARG ERPNEXT_VERSION ARG ERPNEXT_VERSION
ARG ERPNEXT_REPO=https://github.com/frappe/erpnext
RUN --mount=type=cache,target=/root/.cache/pip \ RUN --mount=type=cache,target=/root/.cache/pip \
git clone --depth 1 -b ${ERPNEXT_VERSION} https://github.com/frappe/erpnext apps/erpnext \ git clone --depth 1 -b ${ERPNEXT_VERSION} ${ERPNEXT_REPO} apps/erpnext \
&& install-app erpnext && install-app erpnext