-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
92 additions
and
1 deletion.
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
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,33 @@ | ||
name: Build and Push Docker Image to Google Artifact Registry | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- "**" | ||
tags: | ||
- v* | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "Docker image version tag" | ||
required: true | ||
|
||
run-name: ${{ github.event_name == 'workflow_dispatch' && format('Build (@{1}) inputs={0}', tojson(inputs), github.ref_name) || '' }} | ||
|
||
env: | ||
IMAGE: solid-range-319205/ensuro/eth-exporter | ||
REGISTRY_HOSTNAME: us-docker.pkg.dev | ||
|
||
jobs: | ||
build-push: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
steps: | ||
- name: Build and push | ||
uses: ensuro/github-actions/[email protected] | ||
with: | ||
registry: "${{ env.REGISTRY_HOSTNAME }}" | ||
image: "${{ env.IMAGE }}" | ||
google_credentials: "${{ secrets.GOOGLE_CREDENTIALS }}" | ||
additional_tag: "${{ github.event.inputs.version }}" |
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,34 @@ | ||
FROM python:3.10-slim | ||
|
||
# Alternatives for APP_ENV: | ||
# - production: for production deployment | ||
# - development: for local develpment environment | ||
# - ci: for continous integration environment | ||
|
||
RUN adduser --system --no-create-home --home=/app app | ||
|
||
ARG APP_ENV="production" | ||
ENV APP_ENV $APP_ENV | ||
Check warning on line 11 in Dockerfile GitHub Actions / build-pushLegacy key/value format with whitespace separator should not be used
|
||
|
||
COPY . /app | ||
WORKDIR /app | ||
|
||
# Required since we don't copy the .git folder into the image. | ||
# Production image should be built with `--arg=DOCKER_METADATA_OUTPUT_VERSION=$(python setup.py --version)` to inject the correct version into the package. | ||
ARG DOCKER_METADATA_OUTPUT_VERSION=0.0.1-beta1 | ||
ENV SETUPTOOLS_SCM_PRETEND_VERSION=$DOCKER_METADATA_OUTPUT_VERSION | ||
|
||
RUN if [ $APP_ENV = "production" ]; then \ | ||
pip install . \ | ||
&& rm -rf /app \ | ||
&& mkdir -p /app; \ | ||
else \ | ||
pip install -e .; \ | ||
fi | ||
|
||
|
||
EXPOSE 8000 | ||
|
||
USER app | ||
|
||
ENTRYPOINT ["python", "-m", "eth_exporter.exporter"] |
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
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