Skip to content

Commit

Permalink
fix(repo): image for fuel-streams-ws
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Dec 19, 2024
1 parent 71119fa commit 615acd9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/docker_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ name: Build and publish Docker image

on:
workflow_dispatch:
inputs:
image_type:
description: "Choose which image to build (publisher/webserver/both)"
required: true
type: choice
options:
- publisher
- webserver
- both
default: "both"
push:
branches:
- main
Expand Down Expand Up @@ -32,7 +42,9 @@ jobs:
id: sha
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Build and push Docker (${{ steps.sha.outputs.short_sha }}) for publisher
- name: Build and push Docker for publisher
if: github.event.inputs.image_type == 'publisher' || github.event.inputs.image_type == 'both'
|| github.event_name != 'workflow_dispatch'
uses: ./.github/actions/docker-publish
id: publish-fuel-streams-nats
with:
Expand All @@ -41,7 +53,9 @@ jobs:
image: ghcr.io/fuellabs/fuel-streams-publisher
dockerfile: cluster/docker/fuel-streams-publisher.Dockerfile

- name: Build and push Docker (${{ steps.sha.outputs.short_sha }}) for webserver
- name: Build and push Docker for webserver
if: github.event.inputs.image_type == 'webserver' || github.event.inputs.image_type == 'both'
|| github.event_name != 'workflow_dispatch'
uses: ./.github/actions/docker-publish
id: publish-fuel-webserver-nats
with:
Expand Down
22 changes: 17 additions & 5 deletions cluster/docker/fuel-streams-ws.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ ENV JWT_AUTH_SECRET=
WORKDIR /usr/src

RUN apt-get update -y \
&& apt-get install -y --no-install-recommends ca-certificates curl \
&& apt-get install -y --no-install-recommends ca-certificates curl gettext-base \
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
Expand All @@ -85,7 +85,19 @@ COPY --from=builder /root/fuel-streams-ws.d .

EXPOSE ${STREAMER_API_PORT}

# https://stackoverflow.com/a/44671685
# https://stackoverflow.com/a/40454758
# hadolint ignore=DL3025
CMD exec ./fuel-streams-ws
# Create .env file from environment variables
RUN echo 'STREAMER_API_PORT=${STREAMER_API_PORT}\
NATS_URL=${NATS_URL}\
NETWORK=${NETWORK}\
USE_METRICS=${USE_METRICS}\
USE_ELASTIC_LOGGING=${USE_ELASTIC_LOGGING}\
AWS_S3_ENABLED=${AWS_S3_ENABLED}\
AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}\
AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}\
AWS_REGION=${AWS_REGION}\
AWS_ENDPOINT_URL=${AWS_ENDPOINT_URL}\
AWS_S3_BUCKET_NAME=${AWS_S3_BUCKET_NAME}\
JWT_AUTH_SECRET=${JWT_AUTH_SECRET}' > /usr/src/.env.template

# Create .env file at runtime using envsubst
CMD envsubst < /usr/src/.env.template > /usr/src/.env && exec ./fuel-streams-ws

Check warning on line 103 in cluster/docker/fuel-streams-ws.Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-publish-image

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/

0 comments on commit 615acd9

Please sign in to comment.