Skip to content
Merged
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
50 changes: 11 additions & 39 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ jobs:
- platform: linux/arm64
runs-on: ubuntu-arm64
configuration:
- build_configuration: compose
- build_configuration: staging
- build_configuration: production
runs-on: ${{ matrix.arch.runs-on }}
steps:
- name: Prepare
Expand Down Expand Up @@ -173,32 +172,15 @@ jobs:
strategy:
matrix:
configuration:
- build_configuration: compose
tag_suffix: ""
- build_configuration: staging
tag_suffix: ""
- build_configuration: production
# - build_configuration: compose
# tag_suffix: ""
# - build_configuration: staging
# tag_suffix: ""
runs-on: ubuntu-latest
needs:
- build-openmina-frontend-image
steps:
- name: 📥 Checkout
uses: actions/checkout@v3

- name: 🅰️ Get on-chain-voting web version from package.json
id: ocv-web
uses: martinbeentjes/[email protected]
with:
path: frontend

- name: 🏷️ Conditionally Set Tag
id: set_tag
run: |
if [[ "${{ matrix.configuration.build_configuration }}" == "staging" ]]; then
echo "FINAL_TAG=staging-${{ steps.ocv-web.outputs.current-version }}" >> $GITHUB_ENV
else
echo "FINAL_TAG=${{ steps.meta.outputs.version }}" >> $GITHUB_ENV
fi

- name: Download digests
uses: actions/download-artifact@v4
with:
Expand All @@ -214,17 +196,16 @@ jobs:
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_FRONTEND_IMAGE }}
flavor: |
suffix=${{ matrix.configuration.tag_suffix }}
# flavor: |
# suffix=${{ matrix.configuration.tag_suffix }},onlatest=true
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=sha,format=short
type=semver,pattern={{version}},event=tag
type=ref,event=tag
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=${{ env.FINAL_TAG }}
type=raw,value=latest,enable=${{ matrix.configuration.build_configuration == 'compose' }}
type=raw,value=staging,enable={{contains(ref, 'refs/heads/develop')}}

- name: Login to Docker Hub
uses: docker/login-action@v3
Expand All @@ -236,17 +217,8 @@ jobs:
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_FRONTEND_IMAGE }}@sha256:%s ' *) \

- name: Determine tag to use
id: get-tag
run: |
if [ -n "${{ env.FINAL_TAG }}" ]; then
echo "INSPECT_TAG=${{ env.FINAL_TAG }}" >> $GITHUB_OUTPUT
else
echo "INSPECT_TAG=${{ steps.meta.outputs.version }}" >> $GITHUB_OUTPUT
fi
$(printf '${{ env.REGISTRY_FRONTEND_IMAGE }}@sha256:%s ' *)

- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_FRONTEND_IMAGE }}:${{ steps.get-tag.outputs.INSPECT_TAG }}
docker buildx imagetools inspect ${{ env.REGISTRY_FRONTEND_IMAGE }}:${{ steps.meta.outputs.version }}
8 changes: 3 additions & 5 deletions docker-compose.local.producers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ services:

frontend:
container_name: frontend
# TODO: remove `-producer-demo` suffix in the next release, not needed anymore
image: openmina/frontend:0.8.3-producer-demo
# build:
# context: .
# dockerfile: Dockerfile_FE
# args:
# BUILD_CONFIGURATION: block_producers
environment:
OPENMINA_FRONTEND_ENVIRONMENT: block_producers
ports:
- "8070:80"
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ services:

frontend:
image: openmina/frontend:${OPENMINA_FRONTEND_TAG:-latest}
environment:
OPENMINA_FRONTEND_ENVIRONMENT: compose
ports:
- "8070:80"
12 changes: 8 additions & 4 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM node:18 AS BUILD_IMAGE
# Doesn't matter what we put here - it get's overwritten by the docker build command
ARG BUILD_CONFIGURATION=staging
ARG BUILD_CONFIGURATION=production
WORKDIR /app
COPY . .
RUN npm install
Expand All @@ -12,6 +12,10 @@ RUN echo "---------- USING APACHE ----------"
FROM httpd:2.4
COPY --from=BUILD_IMAGE /app/dist/frontend /usr/local/apache2/htdocs/
COPY --from=BUILD_IMAGE /app/httpd.conf /usr/local/apache2/conf/httpd.conf
#FROM nginx:alpine
#COPY --from=BUILD_IMAGE /app/dist/frontend /usr/share/nginx/html
#COPY --from=BUILD_IMAGE /app/nginx.conf /etc/nginx/nginx.conf

COPY docker/startup.sh /usr/local/bin/startup.sh
RUN chmod +x /usr/local/bin/startup.sh

ENTRYPOINT ["/usr/local/bin/startup.sh"]

CMD ["httpd-foreground"]
12 changes: 12 additions & 0 deletions frontend/docker/startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

if [ -n "$OPENMINA_FRONTEND_ENVIRONMENT" ]; then
echo "Using environment: $OPENMINA_FRONTEND_ENVIRONMENT"
cp -f /usr/local/apache2/htdocs/assets/environments/"$OPENMINA_FRONTEND_ENVIRONMENT".js \
/usr/local/apache2/htdocs/assets/environments/env.js
else
echo "No environment specified. Using default."
fi

echo "Starting Apache..."
exec "$@"
Loading