update github actions and comments to the Dockerfile
This commit is contained in:
parent
4e317728a4
commit
0b3f726a60
10
.github/workflows/dev-image.yml
vendored
10
.github/workflows/dev-image.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-buildx-
|
${{ runner.os }}-buildx-
|
||||||
-
|
-
|
||||||
name: Docker Buildx (build)
|
name: Docker Buildx (build amd64 arm64)
|
||||||
run: |
|
run: |
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||||
@ -31,9 +31,9 @@ jobs:
|
|||||||
--platform linux/amd64,linux/arm64 \
|
--platform linux/amd64,linux/arm64 \
|
||||||
--output "type=image,push=false" \
|
--output "type=image,push=false" \
|
||||||
--tag albertoxamin/bang:dev \
|
--tag albertoxamin/bang:dev \
|
||||||
--file ./Dockerfile-armv7 ./
|
--file ./Dockerfile ./
|
||||||
-
|
-
|
||||||
name: Docker Buildx (build)
|
name: Docker Buildx (build armv-7)
|
||||||
run: |
|
run: |
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||||
@ -41,7 +41,7 @@ jobs:
|
|||||||
--platform linux/arm/v7 \
|
--platform linux/arm/v7 \
|
||||||
--output "type=image,push=false" \
|
--output "type=image,push=false" \
|
||||||
--tag albertoxamin/bang:dev \
|
--tag albertoxamin/bang:dev \
|
||||||
--file ./Dockerfile-armv7 ./
|
--file ./Dockerfile ./
|
||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
@ -56,7 +56,7 @@ jobs:
|
|||||||
--platform linux/amd64,linux/arm/v7,linux/arm64 \
|
--platform linux/amd64,linux/arm/v7,linux/arm64 \
|
||||||
--output "type=image,push=true" \
|
--output "type=image,push=true" \
|
||||||
--tag albertoxamin/bang:dev \
|
--tag albertoxamin/bang:dev \
|
||||||
--file ./Dockerfile-armv7 ./
|
--file ./Dockerfile ./
|
||||||
-
|
-
|
||||||
name: Inspect image
|
name: Inspect image
|
||||||
run: |
|
run: |
|
||||||
|
18
.github/workflows/docker-image.yml
vendored
18
.github/workflows/docker-image.yml
vendored
@ -23,12 +23,22 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-buildx-
|
${{ runner.os }}-buildx-
|
||||||
-
|
-
|
||||||
name: Docker Buildx (build)
|
name: Docker Buildx (build amd64 arm64)
|
||||||
run: |
|
run: |
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||||
--cache-to "type=local,dest=/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" \
|
--output "type=image,push=false" \
|
||||||
--tag albertoxamin/bang:latest \
|
--tag albertoxamin/bang:latest \
|
||||||
--file ./Dockerfile ./
|
--file ./Dockerfile ./
|
||||||
@ -39,11 +49,11 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
-
|
-
|
||||||
name: Docker Buildx (push)
|
name: Docker Buildx (push all)
|
||||||
run: |
|
run: |
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
--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" \
|
--output "type=image,push=true" \
|
||||||
--tag albertoxamin/bang:latest \
|
--tag albertoxamin/bang:latest \
|
||||||
--file ./Dockerfile ./
|
--file ./Dockerfile ./
|
||||||
|
53
.github/workflows/tests.yaml
vendored
53
.github/workflows/tests.yaml
vendored
@ -1,12 +1,53 @@
|
|||||||
name: Test Pull requests
|
name: Test Pull requests
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test_build:
|
buildx:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
DOCKER_BUILDKIT: '1'
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
-
|
||||||
- name: Build the Unified Docker image
|
name: Checkout
|
||||||
run: docker build . --file Dockerfile
|
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 ./
|
||||||
|
18
Dockerfile
18
Dockerfile
@ -1,11 +1,23 @@
|
|||||||
|
# build Vue frontend
|
||||||
FROM node:lts-alpine as builder
|
FROM node:lts-alpine as builder
|
||||||
COPY ./frontend .
|
COPY ./frontend .
|
||||||
RUN npm install
|
RUN npm install
|
||||||
RUN npm run build
|
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 --from=builder ./dist /dist/
|
||||||
COPY ./backend /dist/
|
|
||||||
WORKDIR /dist
|
WORKDIR /dist
|
||||||
RUN pip install -r requirements.txt
|
|
||||||
EXPOSE 5001
|
EXPOSE 5001
|
||||||
ENTRYPOINT ["python", "/dist/__init__.py"]
|
ENTRYPOINT ["python", "/dist/__init__.py"]
|
||||||
|
@ -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"]
|
|
Loading…
Reference in New Issue
Block a user