-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔨 Creating scripts to run Astro in Docker (#2641)
- Loading branch information
1 parent
1ce40a8
commit c0070c7
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM node:20-alpine | ||
|
||
WORKDIR /app | ||
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser | ||
|
||
RUN apk --no-cache update && \ | ||
apk --no-cache add chromium | ||
|
||
COPY ["package.json", "package-lock.json", "./"] | ||
RUN npm install | ||
|
||
COPY . . | ||
|
||
EXPOSE 3000 | ||
CMD ["npm", "run", "dev", "--", "--host"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
cd $(dirname "$0") | ||
|
||
IMAGE_NAME="fusionauth-site:latest" | ||
PORT=${1:-3000} | ||
|
||
# Building image | ||
if [ "$(docker images -q "${IMAGE_NAME}" 2> /dev/null)" = "" ]; then | ||
docker build -t "${IMAGE_NAME}" . | ||
fi | ||
|
||
# Running docker | ||
CID=$(docker run --rm -q -d -v "${PWD}:/app" -p "${PORT}:3000" "${IMAGE_NAME}") | ||
echo "Started Astro container on http://localhost:${PORT}" | ||
echo "If you want to see the logs, run:" | ||
echo "docker logs -f ${CID}" |