Skip to content

Commit

Permalink
🔨 Creating scripts to run Astro in Docker (#2641)
Browse files Browse the repository at this point in the history
  • Loading branch information
vcampitelli authored Nov 7, 2023
1 parent 1ce40a8 commit c0070c7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions astro/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
node_modules/
15 changes: 15 additions & 0 deletions astro/Dockerfile
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"]
18 changes: 18 additions & 0 deletions astro/run-docker
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}"

0 comments on commit c0070c7

Please sign in to comment.