mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-04-19 04:43:56 +02:00
Add args during build (#607)
This commit is contained in:
parent
297228692c
commit
986b055e11
4 changed files with 21 additions and 1 deletions
9
.github/workflows/pr.yml
vendored
9
.github/workflows/pr.yml
vendored
|
@ -23,6 +23,8 @@ jobs:
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
- name: Cache Docker layers
|
- name: Cache Docker layers
|
||||||
|
# AWS data transfer is pricy
|
||||||
|
if: ${{ matrix.runner-platform != 'self-hosted' }}
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: /tmp/.buildx-cache
|
path: /tmp/.buildx-cache
|
||||||
|
@ -40,6 +42,10 @@ jobs:
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
|
- name: Get current time
|
||||||
|
uses: josStorer/get-current-time@v2
|
||||||
|
id: current-time
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
id: docker_build
|
id: docker_build
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
|
@ -50,6 +56,9 @@ jobs:
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache,mode=min
|
cache-to: type=local,dest=/tmp/.buildx-cache,mode=min
|
||||||
platforms: ${{ matrix.build-arch }}
|
platforms: ${{ matrix.build-arch }}
|
||||||
|
build-args: |
|
||||||
|
COMMIT_HASH=${{ github.sha }}
|
||||||
|
BUILD_DATE=${{ steps.current-time.outputs.time }}
|
||||||
|
|
||||||
combine-and-comment:
|
combine-and-comment:
|
||||||
name: Combine platform tags and leave comment
|
name: Combine platform tags and leave comment
|
||||||
|
|
9
.github/workflows/publish.yml
vendored
9
.github/workflows/publish.yml
vendored
|
@ -25,6 +25,8 @@ jobs:
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
- name: Cache Docker layers
|
- name: Cache Docker layers
|
||||||
|
# AWS data transfer is pricy
|
||||||
|
if: ${{ matrix.runner-platform != 'self-hosted' }}
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: /tmp/.buildx-cache
|
path: /tmp/.buildx-cache
|
||||||
|
@ -38,6 +40,10 @@ jobs:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Get current time
|
||||||
|
uses: josStorer/get-current-time@v2
|
||||||
|
id: current-time
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
id: docker_build
|
id: docker_build
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
|
@ -47,6 +53,9 @@ jobs:
|
||||||
platforms: ${{ matrix.build-arch }}
|
platforms: ${{ matrix.build-arch }}
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache,mode=min
|
cache-to: type=local,dest=/tmp/.buildx-cache,mode=min
|
||||||
|
build-args: |
|
||||||
|
COMMIT_HASH=${{ github.sha }}
|
||||||
|
BUILD_DATE=${{ steps.current-time.outputs.time }}
|
||||||
|
|
||||||
combine:
|
combine:
|
||||||
name: Combine platform tags
|
name: Combine platform tags
|
||||||
|
|
|
@ -27,10 +27,11 @@ COPY . .
|
||||||
RUN yarn prisma generate
|
RUN yarn prisma generate
|
||||||
|
|
||||||
ARG COMMIT_HASH=unknown
|
ARG COMMIT_HASH=unknown
|
||||||
|
ARG BUILD_DATE=unknown
|
||||||
|
|
||||||
ENV DATA_DIR /data
|
ENV DATA_DIR /data
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
ENV BUILD_DATE $(date)
|
|
||||||
ENV COMMIT_HASH $COMMIT_HASH
|
ENV COMMIT_HASH $COMMIT_HASH
|
||||||
|
ENV BUILD_DATE $BUILD_DATE
|
||||||
|
|
||||||
CMD ["yarn", "start"]
|
CMD ["yarn", "start"]
|
||||||
|
|
|
@ -10,6 +10,7 @@ const logBanner = () => {
|
||||||
githubSponsor: 'codetheweb',
|
githubSponsor: 'codetheweb',
|
||||||
madeByPrefix: 'Made with 🎶 by ',
|
madeByPrefix: 'Made with 🎶 by ',
|
||||||
buildDate: process.env.BUILD_DATE ? new Date(process.env.BUILD_DATE) : undefined,
|
buildDate: process.env.BUILD_DATE ? new Date(process.env.BUILD_DATE) : undefined,
|
||||||
|
commit: process.env.COMMIT_HASH ?? 'unknown',
|
||||||
}).join('\n'));
|
}).join('\n'));
|
||||||
console.log('\n');
|
console.log('\n');
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue