Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build a docker image with greenframe-cli #19

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ jobs:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}

- name: ⚙️ Build docker image
run: make build-docker-image

- name: 🚀 Push docker image
run: make push-docker-image
if: ${{ github.ref == 'refs/heads/production' }}
env:
DOCKER_REGISTRY_USER: ${{secrets.DOCKER_REGISTRY_USER}}
DOCKER_REGISTRY_PASS: ${{secrets.DOCKER_REGISTRY_PASS}}

- name: 📜 Update readme
uses: stefanzweifel/git-auto-commit-action@v4
with:
Expand Down
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# syntax=docker/dockerfile:1
FROM node:16 as base

RUN apt update && apt install -y \
apt-transport-https \
bash \
ca-certificates \
curl \
git \
gnupg2 \
lsb-release \
python3 \
software-properties-common

# Install docker
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian buster stable"
RUN apt update && apt install -y \
containerd.io \
docker-ce \
docker-ce-cli \
docker-compose-plugin \
&& rm -rf /var/lib/apt/lists/*

# Install greenframe cli
RUN cd /root \
&& curl https://assets.greenframe.io/install.sh | bash
ENV PATH $PATH:/root/.local/bin

RUN mkdir /app
RUN git config --global --add safe.directory /app
WORKDIR /app

ENTRYPOINT ["greenframe"]
CMD ["--version"]
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ upload-installation-scripts: ## Publish on the bucket installion bash scripts
promote-production: upload-installation-scripts ## Publish uploaded tarballs on a stable channel
npx oclif promote --version $(PACKAGE_VERSION) --sha $(SHORT_HASH) -t $(DEPLOY_TARGETS) && yarn set version stable

build-docker-image: ## Create a docker image with the latest published version
docker build -t marmelab/greenframe .

push-docker-image: ## Tag & push the docker image to the docker hub registry
docker login
docker tag marmelab/greenframe marmelab/greenframe:latest
docker tag marmelab/greenframe marmelab/greenframe:$(PACKAGE_VERSION)
docker push marmelab/greenframe:latest marmelab/greenframe:$(PACKAGE_VERSION)

test: test-unit test-e2e ## Launch all tests

test-unit: ## Launch unit test
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,19 @@ DESCRIPTION
_See code: [dist/commands/update.ts](https://github.com/marmelab/greenframe-cli/blob/v1.5.0/dist/commands/update.ts)_
<!-- commandsstop -->

## Docker

From version 1.5.1, the command line tool can be used in a docker container.

```
$ docker run marmelab/greenframe --help
```
```
$ docker run marmelab/greenframe [COMMAND]
```

[All previous described commands](#commands) are available in the docker image.

## License

GreenFrame is licensed under the [Elastic License v2.0](https://www.elastic.co/licensing/elastic-license).
Expand Down