add workflow for building containers

This commit is contained in:
ІО-23 Шмуляр Олег 2025-05-25 17:17:56 +03:00
parent 99152733ce
commit 393b426e85
3 changed files with 47 additions and 8 deletions

View File

@ -0,0 +1,33 @@
name: build-container-backend
on:
workflow_dispatch:
jobs:
build-x86_64:
runs-on: hardware-x86_64
steps:
- name: Pull repository
run: |
git init
git remote add gitea http://10.1.1.1:3000/hasslesstech/sdlc-project
git fetch gitea
git checkout gitea/master
- name: Build docker image
run: docker build backend/ -f backend/Dockerfile-x86_64 -t 10.5.1.5:5000/sdlc/x86_64
- name: Push docker image to registry
run: docker push 10.5.1.5:5000/sdlc/x86_64
# build-armv7:
# runs-on: hardware-armv7
# steps:
# - name: Pull repository
# run: |
# git init
# git remote add gitea http://10.1.1.1:3000/hasslesstech/sdlc-project
# git fetch gitea
# git checkout gitea/master
# - name: Build docker image
# run: docker build backend/ -f backend/Dockerfile-armv7 -t 10.5.1.5:5000/sdlc/armv7
# - name: Push docker image to registry
# run: docker push 10.5.1.5:5000/sdlc/armv7

13
backend/Dockerfile-armv7 Normal file
View File

@ -0,0 +1,13 @@
FROM cmosh/alpine-arm AS build
RUN apk --update add python3
RUN mkdir /venv /app
RUN python3 -m venv /venv
ENV PATH="/venv/bin:$PATH"
RUN apk add build-base linux-headers musl-dev python3-dev libpq-dev
RUN pip3 install flask uwsgi psycopg2
EXPOSE 9090/tcp
ENTRYPOINT ["uwsgi", "--http", ":9090", "--callable", "app", "--wsgi-file", "/app/main.py"]

View File

@ -1,6 +1,6 @@
FROM alpine:latest AS build
RUN apk add python3
RUN apk --update add python3
RUN mkdir /venv /app
RUN python3 -m venv /venv
ENV PATH="/venv/bin:$PATH"
@ -8,13 +8,6 @@ ENV PATH="/venv/bin:$PATH"
RUN apk add build-base linux-headers musl-dev python3-dev libpq-dev
RUN pip3 install flask uwsgi psycopg2
#FROM alpine:latest AS prod
#RUN apk add python3
#ENV PATH="/venv/bin:$PATH"
#COPY --from=build /venv /venv
EXPOSE 9090/tcp
ENTRYPOINT ["uwsgi", "--http", ":9090", "--callable", "app", "--wsgi-file", "/app/main.py"]