-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into SERVICES-2563-integrate-assets-cdn
- Loading branch information
Showing
50 changed files
with
2,783 additions
and
1,905 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Publish Docker image | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
attestations: write | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '18' # Specify your Node.js version | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: multiversx/mx-api-service | ||
|
||
- name: Build and push Docker image | ||
id: push | ||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
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,17 @@ | ||
FROM node:18.19-alpine | ||
|
||
WORKDIR /app | ||
RUN chown -R node:node /app | ||
|
||
USER node | ||
RUN mkdir -p /app/dist/src | ||
COPY --chown=node . /app | ||
|
||
RUN npm install | ||
RUN npm run init | ||
RUN npm run build | ||
|
||
EXPOSE 3001 | ||
RUN chmod +x entrypoint.sh | ||
|
||
CMD ["./entrypoint.sh"] |
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
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,46 @@ | ||
#!/bin/sh | ||
# ENV VARIABLES | ||
# MVX_ENV - defines what config to copy (default devnet) | ||
# ELASTICSEARCH_URL - defines custom elasticsearch url - eg https://devnet-index.multiversx.com | ||
# GATEWAY_URL - defines custom gateway url - eg https://devnet-gateway.multiversx.com | ||
# REDIS_IP - defines redis ip - default 127.0.0.1 | ||
|
||
# CHECK IF ENV IS DEFINED | ||
if [ -n "$MVX_ENV" ] && [ "$MVX_ENV" = "devnet" ]; then | ||
# Copy config file | ||
cp ./config/config.${MVX_ENV}.yaml /app/dist/config/config.yaml | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "Config file copied successfully from config/config.${MVX_ENV}.yaml /app/dist/config/config.yaml" | ||
else | ||
echo "Failed to copy the file." | ||
fi | ||
|
||
else | ||
cp ./config/config.devnet.yaml /app/dist/config/config.yaml | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "Default config file copied successfully from config/config.devnet.yaml /app/dist/config/config.yaml" | ||
else | ||
echo "Failed to copy the file." | ||
fi | ||
fi | ||
|
||
# Replaces urls if defined | ||
if [ -n "$REDIS_IP" ]; then | ||
echo "Redis IP defined: ${REDIS_IP}, replacing in config" | ||
sed -i "s|redis: '127.0.0.1'|redis: '${REDIS_IP}'|g" /app/dist/config/config.yaml | ||
fi | ||
|
||
if [ -n "$ELASTICSEARCH_URL" ]; then | ||
echo "Elasticsearch url defined: ${ELASTICSEARCH_URL}, replacing in config" | ||
sed -i "/^ elastic:/!b; n; s|.*| - '${ELASTICSEARCH_URL}'|" /app/dist/config/config.yaml | ||
fi | ||
|
||
if [ -n "$GATEWAY_URL" ]; then | ||
echo "Gateway url defined: ${GATEWAY_URL}, replacing in config" | ||
sed -i "/^ gateway:/!b; n; s|.*| - '${GATEWAY_URL}'|" /app/dist/config/config.yaml | ||
fi | ||
|
||
|
||
exec /usr/local/bin/node dist/src/main.js |
Oops, something went wrong.