added a Dockerfile and gitlab-ci config

This commit is contained in:
Micha Gläß-Stöcker 2021-08-23 20:30:31 +02:00
parent 427ea588aa
commit 7fb882b61d
3 changed files with 48 additions and 0 deletions

3
.dockerignore Normal file
View file

@ -0,0 +1,3 @@
build
node_modules
.git

21
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,21 @@
image: egon0/docker-with-buildx-and-git
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
services:
- docker:dind
build:
stage: build
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
D_IMAGE_TAG: egon0/openwrt-firmware-selector-multiarch:$CI_COMMIT_REF_SLUG
D_LATEST_TAG: egon0/openwrt-firmware-selector-multiarch:latest
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
- docker buildx create --use --name A$CI_COMMIT_SHORT_SHA
- docker buildx build --platform $BUILD_PLATFORMS --push -t $IMAGE_TAG -t $CI_REGISTRY_IMAGE:latest -t $D_IMAGE_TAG -t $D_LATEST_TAG .

24
Dockerfile Normal file
View file

@ -0,0 +1,24 @@
FROM node:lts-alpine as build
ARG HOMEPAGE="/"
ARG ASU_URL="https://chef.libremesh.org"
WORKDIR /usr/src/app
COPY . .
RUN cat src/config.ts
RUN sed -i "s#asu_url: 'https://chef.libremesh.org'#asu_url: '$ASU_URL'#g" src/config.ts
RUN cat src/config.ts
# quick hack to get the multiarch builds running
RUN yarn add @material-ui/icons
# make the homepage config var configurable on buildtime via docker build-arg
RUN yarn add json
RUN node_modules/.bin/json -I -f package.json -e "this.homepage='$HOMEPAGE'"
RUN yarn install
RUN yarn build
FROM nginx:stable-alpine AS release
COPY --from=build /usr/src/app/build /usr/share/nginx/html