Verified Commit 48dd7d54 authored by EorlBruder's avatar EorlBruder
Browse files

feat(docker): created prod and dev docker-images

parent 3aafa0dd
...@@ -7,15 +7,28 @@ LABEL maintainer="David Trattnig <david.trattnig@subsquare.at>" ...@@ -7,15 +7,28 @@ LABEL maintainer="David Trattnig <david.trattnig@subsquare.at>"
WORKDIR /aura WORKDIR /aura
COPY package*.json ./ COPY package*.json ./
RUN npm install RUN npm install
RUN apk add bash
# Development Stage # Development Stage
FROM base AS dev FROM base AS dev
EXPOSE 5000 EXPOSE 5000
CMD ["./run.sh", "dev"] ENV HOST=0.0.0.0
COPY . .
CMD ["bash", "./run.sh", "dev"]
# Production Stage # Production Stage
FROM base AS prod FROM base AS prod_builder
COPY . . COPY . .
CMD ["./run.sh", "build"]
\ No newline at end of file RUN mv config/docker.env .env
RUN bash ./run.sh build
FROM nginx:stable-alpine AS prod
COPY nginx/nginx.prod.template /etc/nginx/conf.d/nginx.template
COPY nginx/run.sh /run.sh
COPY --from=prod_builder /aura/public/build /usr/share/nginx/html
CMD /run.sh
NAME="Studio Clock" NAME="Studio Clock"
LOGO="https://gitlab.servus.at/aura/meta/-/raw/master/images/aura-logo.png" LOGO="https://gitlab.servus.at/aura/meta/-/raw/master/assets/images/aura-logo.png"
LOGO_SIZE="100px" LOGO_SIZE="100px"
API_URL="http://localhost:8008/api/v1/" API_URL="http://localhost:8008/api/v1/"
UNKNOWN_TITLE="Unknown Title" UNKNOWN_TITLE="Unknown Title"
...@@ -7,4 +7,4 @@ NO_CURRENT_TIMESLOT="No show playing" ...@@ -7,4 +7,4 @@ NO_CURRENT_TIMESLOT="No show playing"
NO_NEXT_TIMESLOT="Nothing scheduled next" NO_NEXT_TIMESLOT="Nothing scheduled next"
PLAY_OFFSET=3 PLAY_OFFSET=3
CSS="" CSS=""
FALLBACK_TEXT="FALLBACK" FALLBACK_TEXT="FALLBACK"
\ No newline at end of file
NAME="$NAME"
LOGO="$LOGO_URL"
LOGO_SIZE="$LOGO_SIZE"
API_URL="$ENGINE_URL"
UNKNOWN_TITLE="$UNKNOWN_TITLE_STRING"
NO_CURRENT_TIMESLOT="$NO_CURRENT_TIMESLOT_STRING"
NO_NEXT_TIMESLOT="$NO_NEXT_TIMESLOT_STRING"
PLAY_OFFSET=$PLAY_OFFSET
CSS="$CSS"
FALLBACK_TEXT="$FALLBACK_TEXT"
server {
listen 80;
server_name ${DASHBOARD_CLOCK_HOST};
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
}
#!/usr/bin/env sh
# When we get killed, kill all our children
trap "exit" INT TERM
trap "kill 0" EXIT
envsubst "`env | awk -F = '{printf \" $$%s\", $$1}'`" < /etc/nginx/conf.d/nginx.template > /etc/nginx/conf.d/default.conf
for file in /usr/share/nginx/html/*.js* /usr/share/nginx/html/index.html;
do
sed -i 's|\$NAME|'"${NAME}"'|g' $file
sed -i 's|\$LOGO_URL|'"${LOGO_URL}"'|g' $file
sed -i 's|\$ENGINE_URL|'"${ENGINE_URL:-engine-api:8008/api/v1}"'|g' $file
sed -i 's|\$UNKNOWN_TITLE_STRING|'"${UNKNOWN_TITLE_STRING}"'|g' $file
sed -i 's|\$NO_CURRENT_TIMESLOT_STRING|'"${NO_CURRENT_TIMESLOT_STRING}"'|g' $file
sed -i 's|\$NO_NEXT_TIMESLOT_STRING|'"${NO_NEXT_TIMESLOT_STRING}"'|g' $file
sed -i 's|\$PLAY_OFFSET|'"${PLAY_OFFSET}"'|g' $file
sed -i 's|\$CSS|'"${CSS}"'|g' $file
sed -i 's|\$FALLBACK_TEXT|'"${FALLBACK_TEXT}"'|g' $file
done
echo "generated nginx-config"
cat /etc/nginx/conf.d/default.conf
nginx -g "daemon off;"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment