update github actions and comments to the Dockerfile

This commit is contained in:
Alberto Xamin 2021-06-26 12:53:23 +02:00
parent 4e317728a4
commit 0b3f726a60
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
6 changed files with 88 additions and 35 deletions

View File

@ -23,7 +23,7 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-
-
name: Docker Buildx (build)
name: Docker Buildx (build amd64 arm64)
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
@ -31,9 +31,9 @@ jobs:
--platform linux/amd64,linux/arm64 \
--output "type=image,push=false" \
--tag albertoxamin/bang:dev \
--file ./Dockerfile-armv7 ./
--file ./Dockerfile ./
-
name: Docker Buildx (build)
name: Docker Buildx (build armv-7)
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
@ -41,7 +41,7 @@ jobs:
--platform linux/arm/v7 \
--output "type=image,push=false" \
--tag albertoxamin/bang:dev \
--file ./Dockerfile-armv7 ./
--file ./Dockerfile ./
-
name: Login to DockerHub
uses: docker/login-action@v1
@ -56,7 +56,7 @@ jobs:
--platform linux/amd64,linux/arm/v7,linux/arm64 \
--output "type=image,push=true" \
--tag albertoxamin/bang:dev \
--file ./Dockerfile-armv7 ./
--file ./Dockerfile ./
-
name: Inspect image
run: |

View File

@ -23,12 +23,22 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-
-
name: Docker Buildx (build)
name: Docker Buildx (build amd64 arm64)
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--platform linux/amd64,linux/arm/v7 \
--platform linux/amd64,linux/arm64 \
--output "type=image,push=false" \
--tag albertoxamin/bang:latest \
--file ./Dockerfile ./
-
name: Docker Buildx (build armv-7)
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--platform linux/arm/v7 \
--output "type=image,push=false" \
--tag albertoxamin/bang:latest \
--file ./Dockerfile ./
@ -39,11 +49,11 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Docker Buildx (push)
name: Docker Buildx (push all)
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--platform linux/amd64,linux/arm/v7 \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
--output "type=image,push=true" \
--tag albertoxamin/bang:latest \
--file ./Dockerfile ./

View File

@ -1,12 +1,53 @@
name: Test Pull requests
on:
pull_request:
jobs:
test_build:
buildx:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: '1'
steps:
- uses: actions/checkout@v2
- name: Build the Unified Docker image
run: docker build . --file Dockerfile
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v3
-
name: Cache Docker layers
uses: actions/cache@v2
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
-
name: Docker Buildx (test build amd64)
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--platform linux/arm64 \
--output "type=image,push=false" \
--tag albertoxamin/bang:test \
--file ./Dockerfile ./
-
name: Docker Buildx (test build arm64)
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--platform linux/arm64 \
--output "type=image,push=false" \
--tag albertoxamin/bang:test \
--file ./Dockerfile ./
-
name: Docker Buildx (test build armv-7)
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--platform linux/arm/v7 \
--output "type=image,push=false" \
--tag albertoxamin/bang:test \
--file ./Dockerfile ./

View File

@ -1,11 +1,23 @@
# build Vue frontend
FROM node:lts-alpine as builder
COPY ./frontend .
RUN npm install
RUN npm run build
FROM python:3.7.10-slim-stretch
# now we should have a dist folder containing the static website
FROM python:3.7.10-stretch as pybuilder
WORKDIR /code
COPY ./backend /code/
RUN pip install --user -r requirements.txt
# We get the dependencies with the full python image so we can compile the one with missing binaries
FROM python:3.7.10-slim-stretch as app
# copy the dependencies from the pybuilder
COPY --from=pybuilder /root/.local /root/.local
# copy the backend python files from the pybuilder
COPY --from=pybuilder /code /dist
# copy the frontend static files from the builder
COPY --from=builder ./dist /dist/
COPY ./backend /dist/
WORKDIR /dist
RUN pip install -r requirements.txt
EXPOSE 5001
ENTRYPOINT ["python", "/dist/__init__.py"]

View File

@ -1,17 +0,0 @@
FROM node:lts-alpine as builder
COPY ./frontend .
RUN npm install
RUN npm run build
FROM python:3.7.10-stretch as pybuilder
WORKDIR /code
COPY ./backend /code/
RUN pip install --user -r requirements.txt
FROM python:3.7.10-slim-stretch as app
COPY --from=pybuilder /root/.local /root/.local
COPY --from=pybuilder /code /dist
COPY --from=builder ./dist /dist/
WORKDIR /dist
EXPOSE 5001
ENTRYPOINT ["python", "/dist/__init__.py"]

View File

@ -1 +1,8 @@
# bang
This is the repo for the PewPew! game, which is a replica of BANG!.
BANG! is a trademark owned by DVGiochi.
[Frontend Readme](./frontend/README.md)
[Backend Readme](./backend/Readme.md)