Skip to content

Commit

Permalink
Add Alpine images (#5)
Browse files Browse the repository at this point in the history
* Adding alpine build

* Fixed quotes

* Using flavor for the tags

* Split action for quicker build

* Removing branch tag

* Updating documentation
  • Loading branch information
Cyb3r-Jak3 authored May 24, 2021
1 parent a486e4a commit 86da76b
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 15 deletions.
86 changes: 77 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ on:


jobs:
Docker:
Slim:
runs-on: ubuntu-latest
steps:

-
name: Checkout
- name: Checkout
uses: actions/checkout@v2

- name: Login to Docker
Expand All @@ -33,18 +32,19 @@ jobs:
username: ${{ secrets.GITLAB_USER }}
password: ${{ secrets.GITLAB_TOKEN }}


- name: Docker meta
- name: Docker Meta
id: meta
uses: docker/metadata-action@v3
with:
images: cyb3rjak3/pypy-flask,ghcr.io/cyb3r-jak3/pypy-flask,registry.gitlab.com/cyb3r-jak3/pypy-flask
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
labels: |
org.label-schema.vcs-url=https://github.com/Cyb3r-Jak3/pypy-flask.git
org.label-schema.schema-version=1.0.0-rc1
- name: Set up QEMU
uses: docker/[email protected]
Expand All @@ -56,10 +56,10 @@ jobs:
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: buildx-${{ github.sha }}
restore-keys: buildx
key: buildx-slim-${{ github.sha }}
restore-keys: buildx-slim

- name: Build and Push
- name: Slim Build and Push
uses: docker/[email protected]
with:
platforms: linux/amd64,linux/arm64
Expand All @@ -68,3 +68,71 @@ jobs:
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
file: Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

Alpine:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v2

- name: Login to Docker
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login To GitHub
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Login To GitLab
uses: docker/login-action@v1
with:
registry: registry.gitlab.com
username: ${{ secrets.GITLAB_USER }}
password: ${{ secrets.GITLAB_TOKEN }}

- name: Docker Meta
id: meta
uses: docker/metadata-action@v3
with:
images: cyb3rjak3/pypy-flask,ghcr.io/cyb3r-jak3/pypy-flask,registry.gitlab.com/cyb3r-jak3/pypy-flask
flavor: |
suffix=-alpine
tags: |
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
labels: |
org.label-schema.vcs-url=https://github.com/Cyb3r-Jak3/pypy-flask.git
org.label-schema.schema-version=1.0.0-rc1
- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Cache Docker layers
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: buildx-alpine-${{ github.sha }}
restore-keys: buildx-alpine

- name: Alpine Build and Push
uses: docker/[email protected]
with:
platforms: linux/amd64,linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
file: alpine.Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
4 changes: 0 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
FROM pypy:3-slim

LABEL org.label-schema.vcs-url="https://github.com/Cyb3r-Jak3/pypy-flask.git" \
org.label-schema.schema-version="1.0.0-rc1" \
org.opencontainers.image.source="https://github.com/Cyb3r-Jak3/pypy-flask"

COPY requirements.txt /tmp/pip-tmp/
RUN apt-get update \
&& apt install --no-install-recommends -y build-essential \
Expand Down
8 changes: 8 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ You can replace the FROM image with any of the following:
- ghcr.io/cyb3r-jak3/pypy-flask:latest
- cyb3rjak3/pypy-flask:latest
- registry.gitlab.com/cyb3r-jak3/pypy-flask:latest

### Alpine

There are also alpine based images avaiable. All alpine images end with `-alpine`

- ghcr.io/cyb3r-jak3/pypy-flask:latest-alpine
- cyb3rjak3/pypy-flask:latest-alpine
- registry.gitlab.com/cyb3r-jak3/pypy-flask:latest-alpine
10 changes: 10 additions & 0 deletions alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM jamiehewland/alpine-pypy:alpine3.11


RUN apk add --no-cache libffi-dev gcc musl-dev make build-base

COPY requirements.txt /tmp/pip-tmp/
RUN pip --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
&& rm -rf /tmp/pip-tmp

RUN apk del libffi-dev gcc musl-dev make build-base
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Flask==2.0.1
gevent==21.1.2
gunicorn==20.1.0
gunicorn==20.1.0
gevent==21.1.2

0 comments on commit 86da76b

Please sign in to comment.