aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@fretlink.com>2021-10-13 17:27:37 +0200
committerIsmaël Bouya <ismael.bouya@fretlink.com>2021-10-14 11:06:32 +0200
commita7aa57a9b8af87d0992424f0e75de3b7bc8b4811 (patch)
tree4bc5c0ce85fb6afda7c3f48625045bae9a85b4d0
parent51ca88242693d27bff139f25e363c0c629dd05b5 (diff)
downloaddocker-nix-a7aa57a9b8af87d0992424f0e75de3b7bc8b4811.tar.gz
docker-nix-a7aa57a9b8af87d0992424f0e75de3b7bc8b4811.tar.zst
docker-nix-a7aa57a9b8af87d0992424f0e75de3b7bc8b4811.zip
Use github action
-rw-r--r--.github/workflows/docker.yml56
-rw-r--r--.travis.yml19
2 files changed, 56 insertions, 19 deletions
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
new file mode 100644
index 0000000..62cea6d
--- /dev/null
+++ b/.github/workflows/docker.yml
@@ -0,0 +1,56 @@
1name: Build and push docker image
2
3on:
4 pull_request:
5 push:
6 branches:
7 - 'master'
8 tags:
9 - '*'
10
11env:
12 TEST_TAG: fretlink/link
13
14jobs:
15 docker:
16 runs-on: ubuntu-latest
17 strategy:
18 matrix:
19 base_os:
20 - debian
21 - alpine
22 steps:
23 - name: Checkout
24 uses: actions/checkout@v2
25 - name: Set up Docker Buildx
26 uses: docker/setup-buildx-action@v1
27 - name: Build and export to Docker
28 uses: docker/build-push-action@v2
29 with:
30 context: .
31 file: ${{ matrix.base_os }}/Dockerfile
32 load: true
33 tags: ${{ env.TEST_TAG }}
34 - name: Test
35 run: |
36 docker run -it --rm ${{ env.TEST_TAG }} 'nix-channel --list'
37 docker run -it --rm ${{ env.TEST_TAG }} 'nix-env -iA nixpkgs.hello && test "$(hello)" = "Hello, world!"'
38 - name: Get the version
39 if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
40 id: get_version
41 run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
42 - name: Login to DockerHub
43 if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
44 uses: docker/login-action@v1
45 with:
46 username: ${{ secrets.DOCKERHUB_USERNAME }}
47 password: ${{ secrets.DOCKERHUB_TOKEN }}
48 - name: Build and push
49 if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
50 id: docker_build
51 uses: docker/build-push-action@v2
52 with:
53 push: true
54 context: .
55 file: ${{ matrix.base_os }}/Dockerfile
56 tags: fretlink/nix:${{ steps.get_version.outputs.VERSION }}-${{ matrix.base_os }}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 6da21de..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,19 +0,0 @@
1# .travis.yml
2
3services:
4 - docker
5
6addons:
7 apt:
8 packages:
9 - docker-ce
10
11matrix:
12 include:
13 - env: BASE_OS=alpine
14 - env: BASE_OS=debian
15
16script:
17 - docker build --pull -t fretlink/nix -f ${BASE_OS}/Dockerfile .
18 - docker run -it --rm fretlink/nix 'nix-channel --list'
19 - docker run -it --rm fretlink/nix 'nix-env -iA nixpkgs.hello && test "$(hello)" = "Hello, world!"'