feat: add docker build

This commit is contained in:
Aarnav Tale 2024-03-26 10:07:04 -04:00
parent 3b1f0ae6f8
commit bef9b6d46d
No known key found for this signature in database
4 changed files with 31 additions and 0 deletions

7
.dockerignore Normal file
View File

@ -0,0 +1,7 @@
node_modules
.dockerignore
Dockerfile
/.cache
/build
.env

View File

@ -5,3 +5,5 @@ OIDC_CLIENT_ID=headscale
OIDC_ISSUER=https://sso.example.com
OIDC_CLIENT_SECRET=super_secret_client_secret
DISABLE_API_KEY_LOGIN=true
HOST=0.0.0.0
PORT=3000

21
Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM node:20-alpine AS build
WORKDIR /app
RUN npm install -g pnpm
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm run build
RUN pnpm prune --prod
FROM node:20-alpine
WORKDIR /app
COPY --from=build /app/build /app
COPY --from=build /app/node_modules /app/node_modules
RUN echo '{"type":"module"}' > /app/package.json
EXPOSE 3000
ENV NODE_ENV=production
ENV HOST=0.0.0.0
CMD [ "node_modules/.bin/remix-serve", "server/index.js" ]

View File

@ -6,6 +6,7 @@ import tsconfigPaths from 'vite-tsconfig-paths'
installGlobals()
export default defineConfig({
base: '/admin/',
plugins: [remix({
basename: '/admin'
}), tsconfigPaths()]