Skip to content

Commit

Permalink
Improvements to docker setup (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv authored Apr 5, 2022
1 parent 932d586 commit 7f07967
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 9 deletions.
5 changes: 1 addition & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Build command: `docker build -t sqren/backport .`
# Publish: docker push sqren/backport

FROM node:latest

RUN mkdir /app
Expand All @@ -9,5 +6,5 @@ WORKDIR /app
COPY ./entrypoint.sh /entrypoint.sh

RUN npm install backport -g
ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/forward-args-to-backport.sh"]
CMD []
41 changes: 41 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Using the docker image

### Running the published image

```
docker run -it --rm -v $(pwd):/app:ro -v ~/.backport:/root/.backport sqren/backport "$@"
```

### Running from source

```
yarn docker-run
```

# Development

### Build docker image

```
docker build -t sqren/backport .
```

### Test image locally before publishing:

```
docker run -it --rm -v $(pwd):/app:ro -v ~/.backport:/root/.backport sqren/backport "$@"
```

### Publish to Docker hub

```
docker push sqren/backport
```

## Authenticate with docker hub

```
docker login
```

A personal access token can be created [here](https://hub.docker.com/settings/security)
3 changes: 1 addition & 2 deletions docker/backport.sh → docker/build-and-run-dockerfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
# "$@": pass all bash arguments to docker (which into turn passes them to backport cli inside container)

cd $(dirname $0)
docker run -it --rm --name backport -v $(pwd):/app:ro -v ~/.backport:/root/.backport $(docker build -q .) "$@"

docker run -it --rm -v $(pwd):/app:ro -v ~/.backport:/root/.backport $(docker build --tag backport -q .) "$@"
2 changes: 0 additions & 2 deletions docker/entrypoint.sh

This file was deleted.

4 changes: 4 additions & 0 deletions docker/forward-args-to-backport.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This file is only needed to forward arguments to backport inside docker

#!/bin/bash
backport "$@"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"test-mutation": "jest --config ./jest.config.mutation.js",
"test-private": "jest --config ./jest.config.private.js",
"test": "jest",
"docker-run": "./docker/backport.sh"
"docker-run": "./docker/build-and-run-dockerfile.sh"
},
"lint-staged": {
"*.ts": [
Expand Down

0 comments on commit 7f07967

Please sign in to comment.