-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from gpailler/master
- Loading branch information
Showing
3 changed files
with
75 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.git | ||
.gitignore | ||
.github | ||
README.MD | ||
LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Docker image | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
docker_tag: | ||
description: 'Docker image tag' | ||
required: true | ||
default: 'latest' | ||
|
||
env: | ||
PLATFORMS: linux/amd64,linux/arm/v6,linux/arm64 | ||
DOCKER_HUB_REPOSITORY: ${{ github.repository }} | ||
DOCKER_HUB_TAG: ${{ github.event.inputs.docker_tag }} | ||
|
||
jobs: | ||
docker: | ||
name: Docker build and push | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up QEMU for multi-arch build | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
platforms: ${{ env.PLATFORMS }} | ||
push: true | ||
tags: ${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.DOCKER_HUB_TAG }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
FROM python:3-alpine | ||
FROM python:3-alpine AS base | ||
|
||
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/community' >> /etc/apk/repositories | ||
RUN apk update | ||
RUN apk add --no-cache pkgconfig gammu=1.39.0-r2 gammu-libs=1.39.0-r2 gammu-dev=1.39.0-r2 | ||
RUN mkdir ssl | ||
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/community' >> /etc/apk/repositories \ | ||
&& apk update \ | ||
&& apk add --no-cache pkgconfig gammu=1.39.0-r2 gammu-libs=1.39.0-r2 gammu-dev=1.39.0-r2 | ||
|
||
ENV BASE_PATH /sms-gw | ||
RUN mkdir $BASE_PATH | ||
WORKDIR $BASE_PATH | ||
ADD requirements.txt . | ||
ADD gammu.config . | ||
ADD credentials.txt . | ||
ADD support.py . | ||
RUN python -m pip install -U pip | ||
|
||
#RUN pip install -r requirements.txt | ||
# Build dependencies in a dedicated stage | ||
FROM base AS dependencies | ||
COPY requirements.txt . | ||
RUN apk add --no-cache --virtual .build-deps libffi-dev openssl-dev gcc musl-dev python3-dev cargo \ | ||
&& pip install -r requirements.txt | ||
|
||
RUN apk add --no-cache --virtual .build-deps libffi-dev openssl-dev gcc musl-dev \ | ||
&& pip install -r requirements.txt \ | ||
&& apk del .build-deps libffi-dev openssl-dev gcc musl-dev | ||
# Switch back to base layer for final stage | ||
FROM base AS final | ||
ENV BASE_PATH /sms-gw | ||
RUN mkdir $BASE_PATH /ssl | ||
WORKDIR $BASE_PATH | ||
COPY . $BASE_PATH | ||
|
||
ADD run.py . | ||
COPY --from=dependencies /root/.cache /root/.cache | ||
RUN pip install -r requirements.txt && rm -rf /root/.cache | ||
|
||
CMD [ "python", "./run.py" ] |