mirror of
https://github.com/Portabase/agent.git
synced 2026-09-11 22:11:52 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 358bffd675 | |||
| 25e08a2b94 | |||
| dc563d3cfd | |||
| 92ad1cbfb4 | |||
| 82d5306dd4 | |||
| 52714cda21 | |||
| fa46d1bbc4 | |||
| 5535b4b22f | |||
| 0e86a813b5 | |||
| ecdb4a067d | |||
| 8078d733e4 | |||
| 06c4a05cbe | |||
| 6985260a8e | |||
| 313693f50b | |||
| 2e7ccb7897 | |||
| 11cba862ab | |||
| 7b40ce6d83 | |||
| e6b0653e48 |
+281
-24
@@ -1,3 +1,198 @@
|
||||
#name: Docker Publish
|
||||
#
|
||||
#on:
|
||||
# workflow_call:
|
||||
# inputs:
|
||||
# image_name:
|
||||
# required: false
|
||||
# type: string
|
||||
# default: 'portabase/agent'
|
||||
# add_latest:
|
||||
# required: false
|
||||
# type: boolean
|
||||
# default: false
|
||||
# target:
|
||||
# required: false
|
||||
# type: string
|
||||
# default: 'prod'
|
||||
# dockerfile:
|
||||
# required: false
|
||||
# type: string
|
||||
# default: './docker/Dockerfile'
|
||||
# secrets:
|
||||
# DOCKER_USERNAME:
|
||||
# required: true
|
||||
# DOCKER_PASSWORD:
|
||||
# required: true
|
||||
#
|
||||
#jobs:
|
||||
# build-and-push:
|
||||
# runs-on: ubuntu-latest
|
||||
# permissions:
|
||||
# packages: write
|
||||
# contents: read
|
||||
# steps:
|
||||
# - name: Check out the repo
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# fetch-depth: 0
|
||||
#
|
||||
# - name: Set up QEMU (enables multi-arch emulation)
|
||||
# uses: docker/setup-qemu-action@v3
|
||||
#
|
||||
# - name: Set up Docker Buildx
|
||||
# uses: docker/setup-buildx-action@v3
|
||||
#
|
||||
# - name: Log in to Docker Hub
|
||||
# uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
||||
# with:
|
||||
# username: ${{ secrets.DOCKER_USERNAME }}
|
||||
# password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
#
|
||||
# - name: Set tags
|
||||
# id: set-tags
|
||||
# run: |
|
||||
# REF_NAME=${GITHUB_REF#refs/tags/}
|
||||
# TAGS="${{ inputs.image_name }}:$REF_NAME"
|
||||
# if [[ "${{ inputs.add_latest }}" == "true" ]]; then
|
||||
# TAGS="$TAGS,${{ inputs.image_name }}:latest"
|
||||
# fi
|
||||
# echo "tags=$TAGS" >> $GITHUB_OUTPUT
|
||||
#
|
||||
# - name: Build and push Docker image
|
||||
# uses: docker/build-push-action@v6
|
||||
# with:
|
||||
# context: .
|
||||
# file: ${{ inputs.dockerfile }}
|
||||
# platforms: linux/amd64,linux/arm64
|
||||
# push: true
|
||||
# tags: ${{ steps.set-tags.outputs.tags }}
|
||||
# target: ${{ inputs.target }}
|
||||
#
|
||||
#name: Docker Publish
|
||||
#
|
||||
#on:
|
||||
# workflow_call:
|
||||
# inputs:
|
||||
# image_name:
|
||||
# required: false
|
||||
# type: string
|
||||
# default: 'portabase/agent'
|
||||
# add_latest:
|
||||
# required: false
|
||||
# type: boolean
|
||||
# default: false
|
||||
# target:
|
||||
# required: false
|
||||
# type: string
|
||||
# default: 'prod'
|
||||
# dockerfile:
|
||||
# required: false
|
||||
# type: string
|
||||
# default: './docker/Dockerfile'
|
||||
# secrets:
|
||||
# DOCKER_USERNAME:
|
||||
# required: true
|
||||
# DOCKER_PASSWORD:
|
||||
# required: true
|
||||
#
|
||||
#jobs:
|
||||
# build-amd64:
|
||||
# name: Build AMD64 Image
|
||||
# runs-on: ubuntu-latest
|
||||
# outputs:
|
||||
# image: ${{ steps.set-job-output.outputs.image }}
|
||||
# steps:
|
||||
# - uses: actions/checkout@v4
|
||||
#
|
||||
# - uses: docker/setup-buildx-action@v3
|
||||
#
|
||||
# - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
||||
# with:
|
||||
# username: ${{ secrets.DOCKER_USERNAME }}
|
||||
# password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
#
|
||||
# - name: Set AMD64 image tag
|
||||
# id: set-tags
|
||||
# run: |
|
||||
# REF_NAME=${GITHUB_REF#refs/tags/}
|
||||
# AMD64_IMAGE="${{ inputs.image_name }}:$REF_NAME-amd64"
|
||||
# echo "amd64_image=$AMD64_IMAGE" >> $GITHUB_OUTPUT
|
||||
#
|
||||
# - name: Build and push AMD64
|
||||
# uses: docker/build-push-action@v6
|
||||
# with:
|
||||
# context: .
|
||||
# file: ${{ inputs.dockerfile }}
|
||||
# platforms: linux/amd64
|
||||
# push: true
|
||||
# tags: ${{ steps.set-tags.outputs.amd64_image }}
|
||||
# target: ${{ inputs.target }}
|
||||
#
|
||||
# build-arm64:
|
||||
# name: Build ARM64 Image
|
||||
# runs-on: ubuntu-24.04-arm
|
||||
# outputs:
|
||||
# image: ${{ steps.set-job-output.outputs.image }}
|
||||
# steps:
|
||||
# - uses: actions/checkout@v4
|
||||
#
|
||||
# - uses: docker/setup-buildx-action@v3
|
||||
#
|
||||
# - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
||||
# with:
|
||||
# username: ${{ secrets.DOCKER_USERNAME }}
|
||||
# password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
#
|
||||
# - name: Set ARM64 image tag
|
||||
# id: set-tags
|
||||
# run: |
|
||||
# REF_NAME=${GITHUB_REF#refs/tags/}
|
||||
# ARM64_IMAGE="${{ inputs.image_name }}:$REF_NAME-arm64"
|
||||
# echo "arm64_image=$ARM64_IMAGE" >> $GITHUB_OUTPUT
|
||||
#
|
||||
# - name: Build and push ARM64
|
||||
# uses: docker/build-push-action@v6
|
||||
# with:
|
||||
# context: .
|
||||
# file: ${{ inputs.dockerfile }}
|
||||
# platforms: linux/arm64
|
||||
# push: true
|
||||
# tags: ${{ steps.set-tags.outputs.arm64_image }}
|
||||
# target: ${{ inputs.target }}
|
||||
#
|
||||
#
|
||||
# create-manifest:
|
||||
# name: Create Multi-Arch Manifest
|
||||
# runs-on: ubuntu-latest
|
||||
# needs:
|
||||
# - build-amd64
|
||||
# - build-arm64
|
||||
# steps:
|
||||
# - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
||||
# with:
|
||||
# username: ${{ secrets.DOCKER_USERNAME }}
|
||||
# password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
#
|
||||
# - name: Create Docker manifest
|
||||
# run: |
|
||||
# REF_NAME=${GITHUB_REF#refs/tags/}
|
||||
#
|
||||
# IMAGE="${{ inputs.image_name }}:$REF_NAME"
|
||||
# AMD64_IMAGE="$IMAGE-amd64"
|
||||
# ARM64_IMAGE="$IMAGE-arm64"
|
||||
#
|
||||
# echo "AMD64_IMAGE=$AMD64_IMAGE"
|
||||
# echo "ARM64_IMAGE=$ARM64_IMAGE"
|
||||
#
|
||||
# docker manifest create $IMAGE $AMD64_IMAGE $ARM64_IMAGE
|
||||
# docker manifest push $IMAGE
|
||||
#
|
||||
# if [ "${{ inputs.add_latest }}" = "true" ]; then
|
||||
# docker manifest create ${{ inputs.image_name }}:latest $AMD64_IMAGE $ARM64_IMAGE
|
||||
# docker manifest push ${{ inputs.image_name }}:latest
|
||||
# fi
|
||||
|
||||
name: Docker Publish
|
||||
|
||||
on:
|
||||
@@ -26,45 +221,107 @@ on:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
build:
|
||||
name: Build and push Docker images
|
||||
runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || matrix.platform == 'linux/arm64' && 'ubuntu-24.04-arm' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [linux/amd64, linux/arm64]
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up QEMU (enables multi-arch emulation)
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
- name: Login to Docker
|
||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Set tags
|
||||
- name: Set image tag
|
||||
id: set-tags
|
||||
run: |
|
||||
REF_NAME=${GITHUB_REF#refs/tags/}
|
||||
TAGS="${{ inputs.image_name }}:$REF_NAME"
|
||||
if [[ "${{ inputs.add_latest }}" == "true" ]]; then
|
||||
TAGS="$TAGS,${{ inputs.image_name }}:latest"
|
||||
if [ "${{ matrix.platform }}" = "linux/amd64" ]; then
|
||||
IMAGE="${{ inputs.image_name }}:$REF_NAME-amd64"
|
||||
else
|
||||
IMAGE="${{ inputs.image_name }}:$REF_NAME-arm64"
|
||||
fi
|
||||
echo "tags=$TAGS" >> $GITHUB_OUTPUT
|
||||
echo "image=$IMAGE" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and push Docker image
|
||||
- name: Build and push image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ${{ inputs.dockerfile }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
platforms: ${{ matrix.platform }}
|
||||
push: true
|
||||
tags: ${{ steps.set-tags.outputs.tags }}
|
||||
target: ${{ inputs.target }}
|
||||
tags: ${{ steps.set-tags.outputs.image }}
|
||||
target: ${{ inputs.target }}
|
||||
|
||||
- name: Prepare artifact name
|
||||
id: artifact
|
||||
run: |
|
||||
platform=${{ matrix.platform }}
|
||||
echo "safe_platform=${platform//\//-}" >> $GITHUB_OUTPUT
|
||||
echo "${{ steps.set-tags.outputs.image }}" > image.txt
|
||||
|
||||
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
|
||||
with:
|
||||
name: image-${{ steps.artifact.outputs.safe_platform }}
|
||||
path: image.txt
|
||||
if-no-files-found: warn
|
||||
compression-level: 6
|
||||
overwrite: false
|
||||
include-hidden-files: false
|
||||
|
||||
create-manifest:
|
||||
name: Create multi-arch Docker manifest
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
|
||||
with:
|
||||
name: image-linux-amd64
|
||||
path: /tmp/digests/amd64
|
||||
|
||||
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
|
||||
with:
|
||||
name: image-linux-arm64
|
||||
path: /tmp/digests/arm64
|
||||
|
||||
- name: Login to Docker
|
||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
# - name: Create and push manifest
|
||||
# run: |
|
||||
# AMD64_IMAGE=$(cat /tmp/digests/amd64/image.txt)
|
||||
# ARM64_IMAGE=$(cat /tmp/digests/arm64/image.txt)
|
||||
# REF_NAME=${GITHUB_REF#refs/tags/}
|
||||
# MANIFEST_IMAGE="${{ inputs.image_name }}:$REF_NAME"
|
||||
#
|
||||
# docker manifest create $MANIFEST_IMAGE $AMD64_IMAGE $ARM64_IMAGE
|
||||
# docker manifest push $MANIFEST_IMAGE
|
||||
#
|
||||
# if [ "${{ inputs.add_latest }}" = "true" ]; then
|
||||
# docker manifest create ${{ inputs.image_name }}:latest $AMD64_IMAGE $ARM64_IMAGE
|
||||
# docker manifest push ${{ inputs.image_name }}:latest
|
||||
# fi
|
||||
|
||||
- name: Create and push manifest list
|
||||
working-directory: /tmp/digests
|
||||
run: |
|
||||
DOCKER_IMAGES="$(cat amd64/image.txt) $(cat arm64/image.txt)"
|
||||
REF_NAME=${GITHUB_REF#refs/tags/}
|
||||
MANIFEST_IMAGE="${{ inputs.image_name }}:$REF_NAME"
|
||||
|
||||
docker buildx imagetools create $DOCKER_IMAGES -t $MANIFEST_IMAGE
|
||||
docker buildx imagetools inspect $MANIFEST_IMAGE
|
||||
|
||||
if [ "${{ inputs.add_latest }}" = "true" ]; then
|
||||
docker buildx imagetools create $DOCKER_IMAGES -t ${{ inputs.image_name }}:latest
|
||||
docker buildx imagetools inspect ${{ inputs.image_name }}:latest
|
||||
fi
|
||||
+1
-1
@@ -22,5 +22,5 @@ keywords:
|
||||
- self-hosted
|
||||
- portabase
|
||||
license: Apache-2.0
|
||||
version: 1.0.4-rc.2
|
||||
version: 1.0.4-rc.20
|
||||
date-released: "2026-01-28"
|
||||
Generated
+1
-1
@@ -1595,7 +1595,7 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
||||
|
||||
[[package]]
|
||||
name = "portabase-agent"
|
||||
version = "1.0.4-rc.1"
|
||||
version = "1.0.4-rc.19"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "portabase-agent"
|
||||
version = "1.0.4-rc.2"
|
||||
version = "1.0.4-rc.20"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
+133
-137
@@ -1,124 +1,7 @@
|
||||
## =========================
|
||||
## Base image (shared)
|
||||
## =========================
|
||||
#FROM rust:1.92.0 AS base
|
||||
#
|
||||
#RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
# pkg-config \
|
||||
# libssl-dev \
|
||||
# tzdata \
|
||||
# redis-server \
|
||||
# ca-certificates \
|
||||
# libpq5 \
|
||||
# libreadline8 \
|
||||
# libncurses6 \
|
||||
# zlib1g \
|
||||
# curl \
|
||||
# mariadb-client \
|
||||
# && apt-get clean \
|
||||
# && rm -rf /var/lib/apt/lists/*
|
||||
#
|
||||
#ARG TARGETARCH
|
||||
#
|
||||
## =========================
|
||||
## PostgreSQL client binaries (versions 12-18)
|
||||
## =========================
|
||||
#
|
||||
#RUN for v in 12 13 14 15 16 17 18; do \
|
||||
# mkdir -p /usr/lib/postgresql/$v/bin; \
|
||||
# done
|
||||
#
|
||||
#COPY assets/tools/amd64/postgresql/ /tmp/pg-x64/
|
||||
#COPY assets/tools/arm64/postgresql/ /tmp/pg-arm/
|
||||
#
|
||||
#RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
||||
# for v in 12 13 14 15 16 17 18; do \
|
||||
# cp -r /tmp/pg-x64/postgresql-$v/bin/* /usr/lib/postgresql/$v/bin/; \
|
||||
# done; \
|
||||
# elif [ "$TARGETARCH" = "arm64" ]; then \
|
||||
# for v in 12 13 14 15 16 17 18; do \
|
||||
# cp -r /tmp/pg-arm/postgresql-$v/bin/* /usr/lib/postgresql/$v/bin/; \
|
||||
# done; \
|
||||
# fi && \
|
||||
# rm -rf /tmp/pg-x64 /tmp/pg-arm && \
|
||||
# chmod +x /usr/lib/postgresql/*/bin/*
|
||||
#
|
||||
## =========================
|
||||
## MongoDB client binaries
|
||||
## =========================
|
||||
#COPY assets/tools/${TARGETARCH}/mongodb/ /usr/local/mongodb/
|
||||
#RUN chmod +x /usr/local/mongodb/bin/*
|
||||
#
|
||||
#WORKDIR /app
|
||||
#
|
||||
## =========================
|
||||
## Development image
|
||||
## =========================
|
||||
#FROM base AS dev
|
||||
#
|
||||
#RUN cargo install cargo-watch
|
||||
#
|
||||
## Pre-cache dependencies
|
||||
#COPY Cargo.toml Cargo.lock ./
|
||||
#RUN mkdir src && echo "fn main() {}" > src/main.rs
|
||||
#RUN cargo build
|
||||
#RUN rm -rf src
|
||||
#
|
||||
#COPY entrypoint.sh /entrypoint.sh
|
||||
#RUN chmod +x /entrypoint.sh
|
||||
#
|
||||
#CMD ["/entrypoint.sh"]
|
||||
#
|
||||
## =========================
|
||||
## Builder (production)
|
||||
## =========================
|
||||
#FROM base AS builder
|
||||
#
|
||||
#COPY . .
|
||||
#RUN cargo build --release
|
||||
#
|
||||
#RUN echo "APP_VERSION=$(cargo pkgid | awk -F# '{print $2}')" > /app/version.env
|
||||
#
|
||||
## =========================
|
||||
## Runtime (production)
|
||||
## =========================
|
||||
#FROM ubuntu:24.04 AS prod
|
||||
#
|
||||
#RUN apt-get update && apt-get install -y \
|
||||
# redis-server \
|
||||
# ca-certificates \
|
||||
# tzdata \
|
||||
# libpq5 \
|
||||
# libreadline8 \
|
||||
# libncurses6 \
|
||||
# zlib1g \
|
||||
# mariadb-client \
|
||||
# && rm -rf /var/lib/apt/lists/*
|
||||
#
|
||||
#
|
||||
#WORKDIR /app
|
||||
#
|
||||
#COPY --from=builder /app/target/release/app /usr/local/bin/app
|
||||
#COPY --from=builder /app/version.env /app/version.env
|
||||
#COPY entrypoint.sh /entrypoint.sh
|
||||
#RUN chmod +x /entrypoint.sh
|
||||
#
|
||||
#COPY --from=base /usr/lib/postgresql/ /usr/lib/postgresql/
|
||||
#COPY --from=base /usr/local/mongodb/bin/ /usr/local/mongodb/bin/
|
||||
#
|
||||
#
|
||||
#ENV APP_ENV=production
|
||||
#
|
||||
#CMD ["/entrypoint.sh"]
|
||||
|
||||
# =========================
|
||||
# Base image (shared)
|
||||
# =========================
|
||||
#FROM rust:1.92.0 AS base
|
||||
ARG BUILDPLATFORM
|
||||
ARG TARGETARCH
|
||||
|
||||
FROM --platform=$BUILDPLATFORM rust:1.92.0 AS base
|
||||
FROM rust:1.92.0 AS base
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
pkg-config \
|
||||
@@ -140,7 +23,10 @@ ARG TARGETARCH
|
||||
# =========================
|
||||
# PostgreSQL client binaries (versions 12-18)
|
||||
# =========================
|
||||
RUN for v in 12 13 14 15 16 17 18; do mkdir -p /usr/lib/postgresql/$v/bin; done
|
||||
|
||||
RUN for v in 12 13 14 15 16 17 18; do \
|
||||
mkdir -p /usr/lib/postgresql/$v/bin; \
|
||||
done
|
||||
|
||||
COPY assets/tools/amd64/postgresql/ /tmp/pg-x64/
|
||||
COPY assets/tools/arm64/postgresql/ /tmp/pg-arm/
|
||||
@@ -149,7 +35,7 @@ RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
||||
for v in 12 13 14 15 16 17 18; do \
|
||||
cp -r /tmp/pg-x64/postgresql-$v/bin/* /usr/lib/postgresql/$v/bin/; \
|
||||
done; \
|
||||
else \
|
||||
elif [ "$TARGETARCH" = "arm64" ]; then \
|
||||
for v in 12 13 14 15 16 17 18; do \
|
||||
cp -r /tmp/pg-arm/postgresql-$v/bin/* /usr/lib/postgresql/$v/bin/; \
|
||||
done; \
|
||||
@@ -172,6 +58,7 @@ FROM base AS dev
|
||||
|
||||
RUN cargo install cargo-watch
|
||||
|
||||
# Pre-cache dependencies
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
RUN mkdir src && echo "fn main() {}" > src/main.rs
|
||||
RUN cargo build
|
||||
@@ -187,20 +74,8 @@ CMD ["/entrypoint.sh"]
|
||||
# =========================
|
||||
FROM base AS builder
|
||||
|
||||
ARG TARGETARCH
|
||||
|
||||
RUN rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
||||
cargo build --release --target x86_64-unknown-linux-gnu && \
|
||||
mv /app/target/x86_64-unknown-linux-gnu/release /app/target/release-app; \
|
||||
else \
|
||||
cargo build --release --target aarch64-unknown-linux-gnu && \
|
||||
mv /app/target/aarch64-unknown-linux-gnu/release /app/target/release-app; \
|
||||
fi
|
||||
|
||||
RUN cargo build --release
|
||||
|
||||
RUN echo "APP_VERSION=$(cargo pkgid | awk -F# '{print $2}')" > /app/version.env
|
||||
|
||||
@@ -220,12 +95,10 @@ RUN apt-get update && apt-get install -y \
|
||||
mariadb-client \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ARG TARGETARCH
|
||||
|
||||
COPY --from=builder /app/target/release-app/app /usr/local/bin/app
|
||||
|
||||
COPY --from=builder /app/target/release/app /usr/local/bin/app
|
||||
COPY --from=builder /app/version.env /app/version.env
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
@@ -233,7 +106,130 @@ RUN chmod +x /entrypoint.sh
|
||||
COPY --from=base /usr/lib/postgresql/ /usr/lib/postgresql/
|
||||
COPY --from=base /usr/local/mongodb/bin/ /usr/local/mongodb/bin/
|
||||
|
||||
|
||||
ENV APP_ENV=production
|
||||
|
||||
CMD ["/entrypoint.sh"]
|
||||
|
||||
# =========================
|
||||
# Base image (shared)
|
||||
# =========================
|
||||
#FROM rust:1.92.0 AS base
|
||||
#
|
||||
#RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
# pkg-config \
|
||||
# libssl-dev \
|
||||
# tzdata \
|
||||
# redis-server \
|
||||
# ca-certificates \
|
||||
# libpq5 \
|
||||
# libreadline8 \
|
||||
# libncurses6 \
|
||||
# zlib1g \
|
||||
# curl \
|
||||
# mariadb-client \
|
||||
# && apt-get clean \
|
||||
# && rm -rf /var/lib/apt/lists/*
|
||||
#
|
||||
#ARG TARGETARCH
|
||||
#
|
||||
## =========================
|
||||
## PostgreSQL client binaries (versions 12-18)
|
||||
## =========================
|
||||
#RUN for v in 12 13 14 15 16 17 18; do mkdir -p /usr/lib/postgresql/$v/bin; done
|
||||
#
|
||||
#COPY assets/tools/amd64/postgresql/ /tmp/pg-x64/
|
||||
#COPY assets/tools/arm64/postgresql/ /tmp/pg-arm/
|
||||
#
|
||||
#RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
||||
# for v in 12 13 14 15 16 17 18; do \
|
||||
# cp -r /tmp/pg-x64/postgresql-$v/bin/* /usr/lib/postgresql/$v/bin/; \
|
||||
# done; \
|
||||
# else \
|
||||
# for v in 12 13 14 15 16 17 18; do \
|
||||
# cp -r /tmp/pg-arm/postgresql-$v/bin/* /usr/lib/postgresql/$v/bin/; \
|
||||
# done; \
|
||||
# fi && \
|
||||
# rm -rf /tmp/pg-x64 /tmp/pg-arm && \
|
||||
# chmod +x /usr/lib/postgresql/*/bin/*
|
||||
#
|
||||
## =========================
|
||||
## MongoDB client binaries
|
||||
## =========================
|
||||
#COPY assets/tools/${TARGETARCH}/mongodb/ /usr/local/mongodb/
|
||||
#RUN chmod +x /usr/local/mongodb/bin/*
|
||||
#
|
||||
#WORKDIR /app
|
||||
#
|
||||
## =========================
|
||||
## Development image
|
||||
## =========================
|
||||
#FROM base AS dev
|
||||
#
|
||||
#RUN cargo install cargo-watch
|
||||
#
|
||||
#COPY Cargo.toml Cargo.lock ./
|
||||
#RUN mkdir src && echo "fn main() {}" > src/main.rs
|
||||
#RUN cargo build
|
||||
#RUN rm -rf src
|
||||
#
|
||||
#COPY entrypoint.sh /entrypoint.sh
|
||||
#RUN chmod +x /entrypoint.sh
|
||||
#
|
||||
#CMD ["/entrypoint.sh"]
|
||||
#
|
||||
## =========================
|
||||
## Builder (production)
|
||||
## =========================
|
||||
#FROM base AS builder
|
||||
#
|
||||
#ARG TARGETARCH
|
||||
#
|
||||
#RUN rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
|
||||
#
|
||||
#COPY . .
|
||||
#
|
||||
#RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
||||
# cargo build --release --target x86_64-unknown-linux-gnu && \
|
||||
# mv /app/target/x86_64-unknown-linux-gnu/release /app/target/release-app; \
|
||||
# else \
|
||||
# cargo build --release --target aarch64-unknown-linux-gnu && \
|
||||
# mv /app/target/aarch64-unknown-linux-gnu/release /app/target/release-app; \
|
||||
# fi
|
||||
#
|
||||
#
|
||||
#RUN echo "APP_VERSION=$(cargo pkgid | awk -F# '{print $2}')" > /app/version.env
|
||||
#
|
||||
## =========================
|
||||
## Runtime (production)
|
||||
## =========================
|
||||
#FROM ubuntu:24.04 AS prod
|
||||
#
|
||||
#RUN apt-get update && apt-get install -y \
|
||||
# redis-server \
|
||||
# ca-certificates \
|
||||
# tzdata \
|
||||
# libpq5 \
|
||||
# libreadline8 \
|
||||
# libncurses6 \
|
||||
# zlib1g \
|
||||
# mariadb-client \
|
||||
# && rm -rf /var/lib/apt/lists/*
|
||||
#
|
||||
#WORKDIR /app
|
||||
#
|
||||
#ARG TARGETARCH
|
||||
#
|
||||
#COPY --from=builder /app/target/release-app/app /usr/local/bin/app
|
||||
#
|
||||
#COPY --from=builder /app/version.env /app/version.env
|
||||
#COPY entrypoint.sh /entrypoint.sh
|
||||
#RUN chmod +x /entrypoint.sh
|
||||
#
|
||||
#COPY --from=base /usr/lib/postgresql/ /usr/lib/postgresql/
|
||||
#COPY --from=base /usr/local/mongodb/bin/ /usr/local/mongodb/bin/
|
||||
#
|
||||
#ENV APP_ENV=production
|
||||
#
|
||||
#CMD ["/entrypoint.sh"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user