feat(Docker): add docker integration
This commit is contained in:
parent
2721e21e23
commit
d8844bc907
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@ -0,0 +1,8 @@
|
||||
.git
|
||||
.github
|
||||
.vscode
|
||||
node_modules
|
||||
.gitignore
|
||||
CHANGELOG.md
|
||||
README.md
|
||||
dist
|
||||
21
Dockerfile
Normal file
21
Dockerfile
Normal file
@ -0,0 +1,21 @@
|
||||
FROM node:20-slim AS base
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN corepack enable
|
||||
WORKDIR /app
|
||||
COPY package.json ./
|
||||
COPY pnpm-lock.yaml ./
|
||||
|
||||
FROM base AS prod-deps
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
||||
|
||||
FROM base AS build-deps
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
|
||||
FROM build-deps AS build
|
||||
COPY . .
|
||||
RUN pnpm run build
|
||||
|
||||
FROM nginx:alpine AS runtime
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
EXPOSE 80
|
||||
24
Readme.md
24
Readme.md
@ -3,14 +3,30 @@
|
||||
## How to use this template
|
||||
|
||||
```sh
|
||||
npm i -g pnpm
|
||||
git clone https://github.com/deployn/astro-deploy new-astro-project
|
||||
cd new-astro-project
|
||||
pnpm install
|
||||
pnpm build
|
||||
pnpm preview
|
||||
```
|
||||
|
||||
Development Server:
|
||||
|
||||
```sh
|
||||
npm i -g pnpm
|
||||
pnpm install
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
Production Build:
|
||||
|
||||
```sh
|
||||
sudo docker build -t astro-deploy .
|
||||
docker run -d -p 1234:80 astro-deploy
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- 🚀 Astro.js 4
|
||||
- 🐳 Docker integration
|
||||
|
||||
## 🧞 Commands
|
||||
|
||||
All commands are run from the root of the project, from a terminal:
|
||||
|
||||
@ -3,7 +3,11 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Document</title>
|
||||
<title>Astro Deploy</title>
|
||||
</head>
|
||||
<body> </body>
|
||||
<body>
|
||||
<main>
|
||||
<div>Hello World</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user