slim images, building docker container from github actions

This commit is contained in:
Andy Pack 2023-05-16 18:30:00 +01:00
parent c88c8e9f26
commit d0b2bba7ca
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
3 changed files with 37 additions and 4 deletions

View File

@ -1,6 +1,10 @@
.github
.idea .idea
.jenkins
.git .git
__pycache__ .venv
.vscode
**/__pycache__
service.json service.json
build build
docs docs

View File

@ -117,6 +117,34 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public publish_dir: ./public
package:
runs-on: ubuntu-latest
needs: [build] # for ignoring bad builds
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & Push Container
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64,linux/arm64
tags: sarsoo/mixonomer:latest
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build # for ignoring bad builds needs: build # for ignoring bad builds

View File

@ -1,4 +1,4 @@
FROM node:19 AS js-build FROM node:19-alpine AS js-build
RUN npm install -g sass RUN npm install -g sass
@ -14,7 +14,7 @@ RUN npm ci
RUN npm run build --if-present RUN npm run build --if-present
RUN sass src/scss/style.scss build/style.css RUN sass src/scss/style.scss build/style.css
FROM python:3.10 as py FROM python:3.10-slim as py
RUN pip install poetry RUN pip install poetry
RUN poetry config virtualenvs.create false RUN poetry config virtualenvs.create false
@ -27,7 +27,8 @@ COPY poetry.lock .
RUN poetry install RUN poetry install
RUN poetry add gunicorn RUN poetry add gunicorn
COPY . ./ COPY ./music ./music
COPY gunicorn.conf.py gunicorn.conf.py
COPY main.api.py main.py COPY main.api.py main.py
COPY --from=js-build /mixonomer/build ./build/ COPY --from=js-build /mixonomer/build ./build/