Add version support for the docker builds & local builds. (#128)

Add experimental support for github actions
This commit is contained in:
Redblueflame
2021-03-29 16:51:49 +02:00
committed by GitHub
parent bb8c0d264e
commit 0834759e1a
4 changed files with 28 additions and 6 deletions

View File

@@ -23,6 +23,14 @@ jobs:
images: |
ghcr.io/modrinth/knossos
docker.io/modrinth/knossos
-
name: Get branch name
id: vars
run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/}
-
name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
@@ -53,3 +61,5 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: |
VERSION_ID=${{ steps.vars.outputs.short_ref }}-${{ steps.slug.outputs.sha8 }}

View File

@@ -1,21 +1,25 @@
# Dockerfile
FROM node:14.16.0-alpine
# create destination directory
RUN mkdir -p /usr/src/knossos
WORKDIR /usr/src/knossos
# update and install dependency
RUN apk update && apk upgrade
RUN apk add git
# create destination directory
RUN mkdir -p /usr/src/knossos
WORKDIR /usr/src/knossos
# copy the app, note .dockerignore
COPY . /usr/src/knossos/
RUN npm install
RUN npm ci
ARG VERSION_ID=unknown
RUN npm run build
EXPOSE 3000
ENV NUXT_HOST=0.0.0.0
ENV NUXT_PORT=3000

View File

@@ -26,13 +26,18 @@
<a target="_blank" href="https://twitter.com/modrinth">Twitter</a>
</li>
</ul>
<span> © Guavy LLC </span>
<span> © Guavy LLC </span><br />
<span v-if="version !== 'unknown'">Version: {{ version }}</span>
</footer>
</template>
<script>
export default {
props: {
version: {
type: String,
default: process.env.version || 'unknown',
},
centered: {
type: Boolean,
default: false,

View File

@@ -182,4 +182,7 @@ export default {
color: 'green',
height: '2px',
},
env: {
version: process.env.VERSION_ID || 'unknown',
},
}