Skip to content

Commit

Permalink
Merge branch 'docker'
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiSakuma committed Oct 12, 2022
2 parents b758f49 + d348968 commit 8da56fe
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 44 deletions.
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ RUN yarn build


#
FROM nginx:1.21
FROM nginx:1.22.0

RUN apt-get update && apt-get install -y jq

WORKDIR /app
COPY --from=build /app/dist dist
COPY --from=build /app/dist/public_path_placeholder/monacoeditorwork dist/monacoeditorwork
COPY docker/entrypoint.sh .
COPY docker/docker-entrypoint.d/* /docker-entrypoint.d/
COPY docker/nginx-default.conf.template /etc/nginx/templates/default.conf.template

ENTRYPOINT ["./entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
#!/bin/bash
# Copy the Vue files to the Vue publicPath

PUBLIC_PATH=${PUBLIC_PATH:?"undefined"}

DIST_DIR="/app/dist"
SITE_DIR_ROOT="/app/site"

SITE_DIR=$(echo $SITE_DIR_ROOT/$PUBLIC_PATH | tr -s /)
SITE_DIR=${SITE_DIR%/} # e.g., /app/site/vue

source $(dirname -- "$0")/envvar.sh;

if [[ ! -d ${DIST_DIR} ]]
then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
#!/bin/bash
# Replace place holders with env vars in Vue files

PUBLIC_PATH=${PUBLIC_PATH:?"undefined"}

SITE_DIR_ROOT="/app/site"

SITE_DIR=$(echo $SITE_DIR_ROOT/$PUBLIC_PATH | tr -s /)
SITE_DIR=${SITE_DIR%/} # e.g., /app/site/vue

PUBLIC_PATH_PLACEHOLDER="/public_path_placeholder/"

PUBLIC_PATH="${PUBLIC_PATH%/}/"
source $(dirname -- "$0")/envvar.sh;

if [[ ! -d ${SITE_DIR} ]]; then
echo "Error: ${SITE_DIR} doesn't exit!"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
#!/bin/bash
# Update config.json

PUBLIC_PATH=${PUBLIC_PATH:?"undefined"}
API_NAME=${API_NAME:?"undefined"}
API_HTTP=${API_HTTP:?"undefined"}
source $(dirname -- "$0")/envvar.sh;

SITE_DIR_ROOT="/app/site"
CONFIG_JSON="config.json"

SITE_DIR=$(echo $SITE_DIR_ROOT/$PUBLIC_PATH | tr -s /)
SITE_DIR=${SITE_DIR%/} # e.g., /app/site/vue

if [[ ! -d ${SITE_DIR} ]]; then
echo "Error: ${SITE_DIR} doesn't exit!"
exit 1
Expand Down
33 changes: 33 additions & 0 deletions docker/docker-entrypoint.d/94-move-monaco-editor-workers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# Copy the Vue files to the Vue publicPath

set -e

source $(dirname -- "$0")/envvar.sh;

FILE=$(basename $0)

BASE_NAME=monacoeditorwork

SOURCE=$(echo ${SITE_DIR}/${PUBLIC_PATH_PLACEHOLDER}/${BASE_NAME} | tr -s /)
DEST=$(echo ${SITE_DIR}/${BASE_NAME} | tr -s /)

if [[ ! -d ${SOURCE} ]]
then
echo "$FILE: the source dir doesn't exist: $SOURCE"
exit 0
fi

if [[ $SOURCE == $DEST ]]
then
echo "$FILE: the source and destination are the same: $SOURCE"
exit 0
fi

command="rm -rf $DEST"
echo + $command
eval $command

command="mv $SOURCE $DEST"
echo + $command
eval $command
20 changes: 20 additions & 0 deletions docker/docker-entrypoint.d/envvar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/echo to be sourced
# This file is source by other files in this directory.

PUBLIC_PATH="${PUBLIC_PATH:-/}"
API_HTTP="${API_HTTP:-http://localhost:8000}"
API_NAME="${API_NAME:-localhost}"

PUBLIC_PATH="${PUBLIC_PATH%/}/" # ensure trailing slash

echo + "PUBLIC_PATH=${PUBLIC_PATH}"
echo + "API_HTTP=${API_HTTP}"
echo + "API_NAME=${API_NAME}"

DIST_DIR="/app/dist"
SITE_DIR_ROOT="/app/site"

SITE_DIR=$(echo $SITE_DIR_ROOT/$PUBLIC_PATH | tr -s /)
SITE_DIR=${SITE_DIR%/} # e.g., /app/site/vue

PUBLIC_PATH_PLACEHOLDER="/public_path_placeholder/"
13 changes: 0 additions & 13 deletions docker/entrypoint.sh

This file was deleted.

0 comments on commit 8da56fe

Please sign in to comment.