Merge pull request #218 from meienberger/production-build

refactore: change production to use ubuntu instead of alpine image
This commit is contained in:
Nicolas Meienberger 2022-09-29 20:36:06 +00:00 committed by GitHub
commit e11569a4ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 10 deletions

View file

@ -19,12 +19,25 @@ COPY ./packages/dashboard /dashboard
RUN npm run build
FROM alpine:3.16.0 as app
FROM ubuntu:22.04 as app
WORKDIR /
RUN apt-get update
# Install docker
RUN apt-get install -y ca-certificates curl gnupg lsb-release jq
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list >/dev/null
RUN apt-get update
RUN apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
# Install node
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get install -y nodejs
# Install dependencies
RUN apk --no-cache add docker-compose nodejs npm bash g++ make git
RUN apt-get install -y bash g++ make git
RUN npm install node-gyp -g
@ -37,9 +50,6 @@ COPY ./packages/dashboard/package*.json /dashboard/
RUN npm install --production
COPY --from=build /api/dist /api/dist
COPY ./packages/system-api /api
COPY --from=build /dashboard/.next /dashboard/.next
COPY ./packages/dashboard /dashboard
WORKDIR /

View file

@ -62,8 +62,6 @@ services:
APPS_REPO_ID: ${APPS_REPO_ID}
APPS_REPO_URL: ${APPS_REPO_URL}
DOMAIN: ${DOMAIN}
dns:
- ${DNS_IP}
networks:
- tipi_main_network
labels:

View file

@ -1,4 +1,4 @@
version: "3.9"
version: "3.7"
services:
reverse-proxy:
@ -62,8 +62,6 @@ services:
APPS_REPO_ID: ${APPS_REPO_ID}
APPS_REPO_URL: ${APPS_REPO_URL}
DOMAIN: ${DOMAIN}
dns:
- ${DNS_IP}
networks:
- tipi_main_network
labels:

View file

@ -108,6 +108,28 @@ function install_jq() {
fi
}
function install_openssl() {
local os="${1}"
echo "Installing openssl for os ${os}" >/dev/tty
if [[ "${os}" == "debian" || "${os}" == "ubuntu" || "${os}" == "pop" ]]; then
sudo apt-get update
sudo apt-get install -y openssl
return 0
elif [[ "${os}" == "centos" ]]; then
sudo yum install -y openssl
return 0
elif [[ "${os}" == "fedora" ]]; then
sudo dnf -y install openssl
return 0
elif [[ "${os}" == "arch" ]]; then
sudo pacman -Sy --noconfirm openssl
return 0
else
return 1
fi
}
OS="$(cat /etc/[A-Za-z]*[_-][rv]e[lr]* | grep "^ID=" | cut -d= -f2 | uniq | tr '[:upper:]' '[:lower:]' | tr -d '"')"
SUB_OS="$(cat /etc/[A-Za-z]*[_-][rv]e[lr]* | grep "^ID_LIKE=" | cut -d= -f2 | uniq | tr '[:upper:]' '[:lower:]' | tr -d '"')"
@ -170,3 +192,23 @@ if ! command -v jq >/dev/null; then
fi
fi
fi
if ! command -v openssl >/dev/null; then
install_openssl "${OS}"
openssl_result=$?
if [[ openssl_result -eq 0 ]]; then
echo "openssl installed"
else
echo "Your system ${OS} is not supported trying with sub_os ${SUB_OS}"
install_openssl "${SUB_OS}"
openssl_sub_result=$?
if [[ openssl_sub_result -eq 0 ]]; then
echo "openssl installed"
else
echo "Your system ${SUB_OS} is not supported please install openssl manually"
exit 1
fi
fi
fi