
- Modified the GitHub Actions workflow to streamline the deployment process by installing Docker directly and using shell commands for building and pushing images. - Changed the base image for the backend Dockerfile from `python:3.11-slim` to `python:alpine` for a smaller footprint. - Updated the frontend Dockerfile to use `node:23-alpine` instead of `node:24-alpine`, and refactored the production stage to use `node:slim`. Added a script for runtime environment variable injection.
38 lines
1.5 KiB
YAML
38 lines
1.5 KiB
YAML
name: Deploy to Production, build images and push to Gitea Registry
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- prod
|
|
|
|
jobs:
|
|
build_and_push:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Docker
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y docker.io
|
|
|
|
- name: Build and push backend image
|
|
env:
|
|
GITEA_USERNAME: ${{ secrets.ME_USERNAME }}
|
|
GITEA_PASSWORD: ${{ secrets.ME_PASSWORD }}
|
|
run: |
|
|
echo $GITEA_PASSWORD | docker login git.vinylnostalgia.com:5000 -u $GITEA_USERNAME --password-stdin
|
|
docker build -t git.vinylnostalgia.com:5000/${{ gitea.repository_owner }}/${{ gitea.repository_name }}-backend:latest ./be -f ./be/Dockerfile.prod
|
|
docker push git.vinylnostalgia.com:5000/${{ gitea.repository_owner }}/${{ gitea.repository_name }}-backend:latest
|
|
|
|
- name: Build and push frontend image
|
|
env:
|
|
GITEA_USERNAME: ${{ secrets.ME_USERNAME }}
|
|
GITEA_PASSWORD: ${{ secrets.ME_PASSWORD }}
|
|
run: |
|
|
echo $GITEA_PASSWORD | docker login git.vinylnostalgia.com:5000 -u $GITEA_USERNAME --password-stdin
|
|
docker build -t git.vinylnostalgia.com:5000/${{ gitea.repository_owner }}/${{ gitea.repository_name }}-frontend:latest ./fe -f ./fe/Dockerfile.prod
|
|
docker push git.vinylnostalgia.com:5000/${{ gitea.repository_owner }}/${{ gitea.repository_name }}-frontend:latest
|