Cleanup justfile and dockerfile

- Add a gitignore for output directory
- Make justfile use multi-lines for readability
- Remove COPY step from Dockerfile
This commit is contained in:
Sravan Balaji
2025-01-01 13:26:23 -05:00
parent 6808d71ca5
commit fff17e62a1
3 changed files with 28 additions and 7 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
public

View File

@@ -5,6 +5,4 @@ WORKDIR /opt/app
RUN npm init -y RUN npm init -y
RUN npm install @11ty/eleventy RUN npm install @11ty/eleventy
COPY . .
CMD [ "npx", "@11ty/eleventy" ] CMD [ "npx", "@11ty/eleventy" ]

View File

@@ -1,13 +1,35 @@
set shell := ["bash", "-c"] set shell := ["bash", "-c"]
HOST_PORT := "1280"
# List just commands by default # List just commands by default
default: default:
@just --list @just --list
# Build image # Build the docker image
build: docker-build:
docker buildx build -f ./docker/Dockerfile --tag 11ty:latest . docker buildx build \
-f ./docker/Dockerfile \
--tag 11ty:latest \
.
# Run development server # Run development server
dev: build dev:
docker run -it -p 1280:8080 11ty:latest npx @11ty/eleventy --serve docker run \
-it \
-p {{HOST_PORT}}:8080 \
-v ./src:/opt/app/src \
-v ./public:/opt/app/public \
-v ./.eleventy.js:/opt/app/.eleventy.js \
11ty:latest \
npx @11ty/eleventy --serve
# Build static site files
build-site:
docker run \
-it \
-v ./src:/opt/app/src \
-v ./public:/opt/app/public \
-v ./.eleventy.js:/opt/app/.eleventy.js \
11ty:latest \
npx @11ty/eleventy