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 install @11ty/eleventy
COPY . .
CMD [ "npx", "@11ty/eleventy" ]

View File

@@ -1,13 +1,35 @@
set shell := ["bash", "-c"]
HOST_PORT := "1280"
# List just commands by default
default:
@just --list
# Build image
build:
docker buildx build -f ./docker/Dockerfile --tag 11ty:latest .
# Build the docker image
docker-build:
docker buildx build \
-f ./docker/Dockerfile \
--tag 11ty:latest \
.
# Run development server
dev: build
docker run -it -p 1280:8080 11ty:latest npx @11ty/eleventy --serve
dev:
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