diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..385cce1 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,34 @@ +name: "Docker build push" + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + packages: write + id-token: write + +jobs: + bake: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/bake-action@v5 + with: + push: true \ No newline at end of file diff --git a/dighosp-des/api.Dockerfile b/dighosp-des/api.Dockerfile index 1c1d210..8ceaa45 100644 --- a/dighosp-des/api.Dockerfile +++ b/dighosp-des/api.Dockerfile @@ -9,9 +9,9 @@ ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get -y dist-upgrade && apt-get -y install gcc RUN mkdir /app -COPY pyproject.toml poetry.lock /app/ +COPY pyproject.toml /app/ -RUN cd /app && poetry install --no-interaction --no-ansi --without dev +RUN cd /app && poetry install --no-interaction --no-ansi --no-root --without dev ###### diff --git a/dighosp-des/des-worker.Dockerfile b/dighosp-des/des-worker.Dockerfile index 33d1332..4f92515 100644 --- a/dighosp-des/des-worker.Dockerfile +++ b/dighosp-des/des-worker.Dockerfile @@ -10,9 +10,9 @@ ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get -y dist-upgrade && apt-get -y install gcc RUN mkdir /app -COPY pyproject.toml poetry.lock /app/ +COPY pyproject.toml /app/ -RUN cd /app && poetry install --no-interaction --no-ansi --without dev +RUN cd /app && poetry install --no-interaction --no-ansi --no-root --without dev ######################################## diff --git a/dighosp-docs/Dockerfile b/dighosp-docs/Dockerfile index 4c5cb40..4cf5926 100644 --- a/dighosp-docs/Dockerfile +++ b/dighosp-docs/Dockerfile @@ -11,8 +11,9 @@ RUN apt-get update && apt-get -y dist-upgrade && apt-get -y install gcc make WORKDIR /dighosp-docs -COPY ./pyproject.toml /dighosp-docs/pyproject.toml -RUN poetry install --no-interaction --no-ansi +COPY ./pyproject.toml /dighosp-docs/ + +RUN poetry install --no-interaction --no-ansi --no-root COPY ./source/ /dighosp-docs/source/ COPY ./Makefile /dighosp-docs/Makefile diff --git a/dighosp-frontend/Dockerfile b/dighosp-frontend/Dockerfile index ab1d575..f4b233b 100644 --- a/dighosp-frontend/Dockerfile +++ b/dighosp-frontend/Dockerfile @@ -9,9 +9,9 @@ ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get -y dist-upgrade && apt-get -y install gcc RUN mkdir /app -COPY pyproject.toml poetry.lock /app/ +COPY pyproject.toml /app/ -RUN cd /app && poetry install --no-interaction --no-ansi --without dev +RUN cd /app && poetry install --no-interaction --no-ansi --no-root --without dev ###### diff --git a/docker-bake.hcl b/docker-bake.hcl new file mode 100644 index 0000000..a763976 --- /dev/null +++ b/docker-bake.hcl @@ -0,0 +1,54 @@ +variable "TAG" { + default = "latest" +} + +group "default" { + targets = [ + "des-api", + "des-worker", + "docs", + "frontend", + "webproxy" + ] +} + +target "des-api" { + context = "dighosp-des" + dockerfile = "api.Dockerfile" + tags = [ + "ghcr.io/cam-digital-hospitals/monorepo-des-api:${TAG}" + ] +} + +target "des-worker" { + context = "dighosp-des" + dockerfile = "des-worker.Dockerfile" + tags = [ + "ghcr.io/cam-digital-hospitals/monorepo-des-worker:${TAG}" + ] +} + +target "docs" { + context = "dighosp-docs" + dockerfile = "Dockerfile" + tags = [ + "ghcr.io/cam-digital-hospitals/monorepo-docs:${TAG}" + ] +} + +target "frontend" { + context = "dighosp-frontend" + contexts = {assets = "assets"} + dockerfile = "Dockerfile" + tags = [ + "ghcr.io/cam-digital-hospitals/monorepo-frontend:${TAG}" + ] +} + +target "webproxy" { + context = "nginx" + dockerfile = "Dockerfile" + tags = [ + "ghcr.io/cam-digital-hospitals/monorepo-webproxy:${TAG}" + ] +}