diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5b34fe7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +node_modules +.venv +.ijwb +.idea \ No newline at end of file diff --git a/.github/workflows/push_containers.yaml b/.github/workflows/push_containers.yaml index 2796681..e20ed87 100644 --- a/.github/workflows/push_containers.yaml +++ b/.github/workflows/push_containers.yaml @@ -18,10 +18,21 @@ jobs: with: path: "~/.cache/bazel" key: bazel - - name: Log into GCR + - name: Log into GHCR run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin - name: Push containers run: | - bazel run //apollo/server:server.push - bazel run //apollo/rpmworker:rpmworker.push - bazel run //apollo/rhworker:rhworker.push + export BUILD_TAG="${GIT_COMMIT:-$(git describe --tags --long --always)}" + + bazel build //apollo/server/static + rm -rf apollo/server/static/* + cp bazel-bin/apollo/server/static/*.css apollo/server/static/ + cp bazel-bin/apollo/server/static/*.js apollo/server/static/ + cp bazel-bin/apollo/server/static/*.map apollo/server/static/ + + docker build -t ghcr.io/resf/apollo-server:$BUILD_TAG -f apollo/server/Dockerfile . + docker build -t ghcr.io/resf/apollo-rpmworker:$BUILD_TAG -f apollo/rpmworker/Dockerfile . + docker build -t ghcr.io/resf/apollo-rhworker:$BUILD_TAG -f apollo/rhworker/Dockerfile . + docker push ghcr.io/resf/apollo-server:$BUILD_TAG + docker push ghcr.io/resf/apollo-rpmworker:$BUILD_TAG + docker push ghcr.io/resf/apollo-rhworker:$BUILD_TAG diff --git a/apollo/rhworker/Dockerfile b/apollo/rhworker/Dockerfile new file mode 100644 index 0000000..a37c369 --- /dev/null +++ b/apollo/rhworker/Dockerfile @@ -0,0 +1,13 @@ +FROM rockylinux:9 + +WORKDIR /app + +RUN dnf update -y && dnf install -y python3 python3-pip +RUN python3 -m venv /opt/venv + +COPY requirements_lock.txt . +RUN /opt/venv/bin/pip3 install -r requirements_lock.txt + +COPY . . + +CMD ["/opt/venv/bin/python3", "-m", "apollo.rhworker"] diff --git a/apollo/rpmworker/Dockerfile b/apollo/rpmworker/Dockerfile new file mode 100644 index 0000000..6fbe1bc --- /dev/null +++ b/apollo/rpmworker/Dockerfile @@ -0,0 +1,13 @@ +FROM rockylinux:9 + +WORKDIR /app + +RUN dnf update -y && dnf install -y python3 python3-pip +RUN python3 -m venv /opt/venv + +COPY requirements_lock.txt . +RUN /opt/venv/bin/pip3 install -r requirements_lock.txt + +COPY . . + +CMD ["/opt/venv/bin/python3", "-m", "apollo.rpmworker"] diff --git a/apollo/server/Dockerfile b/apollo/server/Dockerfile new file mode 100644 index 0000000..708cd9b --- /dev/null +++ b/apollo/server/Dockerfile @@ -0,0 +1,13 @@ +FROM rockylinux:9 + +WORKDIR /app + +RUN dnf update -y && dnf install -y python3 python3-pip +RUN python3 -m venv /opt/venv + +COPY requirements_lock.txt . +RUN /opt/venv/bin/pip3 install -r requirements_lock.txt + +COPY . . + +CMD ["/opt/venv/bin/python3", "-m", "hypercorn", "apollo.server.server", "--bind", "0.0.0.0:8000"]