mirror of
https://github.com/ajnart/homarr.git
synced 2025-10-30 18:15:56 +01:00
Fix docker build
This commit is contained in:
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Dockerfile
|
||||||
|
.dockerignore
|
||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
README.md
|
||||||
|
.git
|
||||||
28
.github/workflows/docker.yml
vendored
28
.github/workflows/docker.yml
vendored
@@ -41,12 +41,18 @@ jobs:
|
|||||||
# If source files changed but packages didn't, rebuild from a prior cache.
|
# If source files changed but packages didn't, rebuild from a prior cache.
|
||||||
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
|
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
|
||||||
- run: yarn install --frozen-lockfile
|
- run: yarn install --frozen-lockfile
|
||||||
- run: yarn export
|
- run: yarn build
|
||||||
- name: Cache build output
|
- name: Cache build output
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
id: restore-build
|
id: restore-build
|
||||||
with:
|
with:
|
||||||
path: ./out/
|
path: |
|
||||||
|
./next.config.js
|
||||||
|
./pages/
|
||||||
|
./public/
|
||||||
|
./.next/static/
|
||||||
|
./.next/standalone/
|
||||||
|
./packages.jsan
|
||||||
key: ${{ github.sha }}
|
key: ${{ github.sha }}
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
@@ -61,16 +67,20 @@ jobs:
|
|||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
id: restore-build
|
id: restore-build
|
||||||
with:
|
with:
|
||||||
path: ./out/
|
path: |
|
||||||
|
./next.config.js
|
||||||
|
./pages/
|
||||||
|
./public/
|
||||||
|
./.next/static/
|
||||||
|
./.next/standalone/
|
||||||
|
./packages.jsan
|
||||||
key: ${{ github.sha }}
|
key: ${{ github.sha }}
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
# list of Docker images to use as base name for tags
|
# list of Docker images to use as base name for tags
|
||||||
images: |
|
images: ghcr.io/${{ github.repository }}
|
||||||
ajnart/homarr
|
|
||||||
ghcr.io/ajnart/homarr
|
|
||||||
# generate Docker tags based on the following events/attributes
|
# generate Docker tags based on the following events/attributes
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
@@ -79,12 +89,6 @@ jobs:
|
|||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
- name: Login to DockerHub
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- name: Login to GHCR
|
- name: Login to GHCR
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
|
|||||||
22
Dockerfile
22
Dockerfile
@@ -1,2 +1,20 @@
|
|||||||
FROM nginx:alpine
|
FROM node:16-alpine
|
||||||
COPY ./out /usr/share/nginx/html
|
WORKDIR /app
|
||||||
|
ENV NODE_ENV production
|
||||||
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
|
COPY /next.config.js ./
|
||||||
|
COPY /public ./public
|
||||||
|
COPY /package.json ./package.json
|
||||||
|
|
||||||
|
# Automatically leverage output traces to reduce image size
|
||||||
|
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
||||||
|
COPY --chown=nextjs:nodejs /.next/standalone ./
|
||||||
|
COPY --chown=nextjs:nodejs /.next/static ./.next/static
|
||||||
|
|
||||||
|
USER nextjs
|
||||||
|
EXPOSE 7575
|
||||||
|
ENV PORT 7575
|
||||||
|
VOLUME /app/data/configs
|
||||||
|
CMD ["node", "server.js"]
|
||||||
|
|||||||
Reference in New Issue
Block a user