Skip to content

Commit 5d6ec47

Browse files
author
And[re]y Bar[a]nov
authored
Merge pull request #4 from lewagon/devops/slimmer-image-ghcr-on-release
copy rake-runner approach
2 parents 51af8a5 + 970bca8 commit 5d6ec47

4 files changed

Lines changed: 102 additions & 10 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
on:
2+
push:
3+
branches: [master]
4+
5+
jobs:
6+
docker:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Set up Docker Buildx
10+
uses: docker/setup-buildx-action@v1
11+
- name: Cache Docker layers
12+
uses: actions/cache@v2
13+
with:
14+
path: /tmp/.buildx-cache
15+
key: ${{ runner.os }}-buildx-${{ github.sha }}
16+
restore-keys: |
17+
${{ runner.os }}-buildx-
18+
- name: Log in to the Container registry
19+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
20+
with:
21+
registry: ghcr.io
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
- name: Build and push
25+
id: docker_build
26+
uses: docker/build-push-action@v2
27+
with:
28+
push: true
29+
tags: ghcr.io/${{ github.repository }}:latest
30+
cache-from: type=local,src=/tmp/.buildx-cache
31+
cache-to: type=local,dest=/tmp/.buildx-cache-new
32+
33+
# Temp fix
34+
# https://github.com/docker/build-push-action/issues/252
35+
# https://github.com/moby/buildkit/issues/1896
36+
- name: Move cache
37+
run: |
38+
rm -rf /tmp/.buildx-cache
39+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
40+
41+
- name: Image digest
42+
run: echo ${{ steps.docker_build.outputs.digest }}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
on:
2+
release:
3+
types: [published, edited]
4+
5+
jobs:
6+
docker:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Set up Docker Buildx
10+
uses: docker/setup-buildx-action@v1
11+
- name: Cache Docker layers
12+
uses: actions/cache@v2
13+
with:
14+
path: /tmp/.buildx-cache
15+
key: ${{ runner.os }}-buildx-${{ github.sha }}
16+
restore-keys: |
17+
${{ runner.os }}-buildx-
18+
- name: Log in to the Container registry
19+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
20+
with:
21+
registry: ghcr.io
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
- name: Build and push
25+
id: docker_build
26+
uses: docker/build-push-action@v2
27+
with:
28+
push: true
29+
tags: ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
30+
cache-from: type=local,src=/tmp/.buildx-cache
31+
cache-to: type=local,dest=/tmp/.buildx-cache-new
32+
33+
# Temp fix
34+
# https://github.com/docker/build-push-action/issues/252
35+
# https://github.com/moby/buildkit/issues/1896
36+
- name: Move cache
37+
run: |
38+
rm -rf /tmp/.buildx-cache
39+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
40+
41+
- name: Image digest
42+
run: echo ${{ steps.docker_build.outputs.digest }}

Dockerfile

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
FROM jupyter/datascience-notebook:python-3.8.5
2-
LABEL maintainer="[email protected]"
3-
4-
ENV LANG en_US.utf8
5-
RUN pip install pytest pylint lxml nbresult
6-
7-
ENV FULLSTACK_FOLDER /data-challenges
8-
WORKDIR $FULLSTACK_FOLDER
9-
# Handle proper permissions later https://denibertovic.com/posts/handling-permissions-with-docker-volumes/ 🙈
10-
USER root
1+
FROM python:3.8.6-slim-buster
2+
RUN apt-get update && apt-get install -y --no-install-recommends make
3+
COPY requirements.txt /requirements.txt
4+
RUN pip install -r /requirements.txt

requirements.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
pytest
2+
pylint
3+
ipdb
4+
pyyaml
5+
nbresult
6+
autopep8
7+
flake8
8+
lxml
9+
requests
10+
bs4
11+
pandas==1.2
12+
matplotlib
13+
numpy
14+
scikit-learn

0 commit comments

Comments
 (0)