Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up docker.yml workflow #47

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions dighosp-des/api.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

######

Expand Down
4 changes: 2 additions & 2 deletions dighosp-des/des-worker.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

########################################

Expand Down
5 changes: 3 additions & 2 deletions dighosp-docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions dighosp-frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

######

Expand Down
54 changes: 54 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -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}"
]
}