Skip to content

Commit

Permalink
update and fix admin-server build
Browse files Browse the repository at this point in the history
  • Loading branch information
matej21 committed Sep 7, 2021
1 parent f3a014c commit 5c030f7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
packages/*/dist
8 changes: 4 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:

admin_server:
image: node:14-alpine
command: '/src/node_modules/.bin/nodemon dist/run-admin.js'
command: 'node dist/server/run-admin.js'

working_dir: /src/packages/admin-server
volumes:
Expand All @@ -29,7 +29,7 @@ services:

CONTEMBER_API_ENDPOINT: 'http://api:4000'
CONTEMBER_LOGIN_TOKEN: '1111111111111111111111111111111111111111'
CONTEMBER_PUBLIC_DIR: '/src/packages/admin-server/dist'
CONTEMBER_PUBLIC_DIR: '/src/packages/admin-server/dist/public'

CONTEMBER_S3_ENDPOINT: 'http://s3:9000'
CONTEMBER_S3_REGION: '_'
Expand All @@ -45,7 +45,7 @@ services:

admin_server_esbuild:
image: node:14-alpine
command: '/src/node_modules/.bin/esbuild src/run-admin.ts --bundle --watch --sourcemap --platform=node --outdir=dist'
command: 'npm run watch:server'

working_dir: /src/packages/admin-server
volumes:
Expand All @@ -54,7 +54,7 @@ services:

admin_server_vite:
image: node:14-alpine
command: '/src/node_modules/.bin/vite build public --config vite.config.js --watch'
command: 'npm run watch:public'

working_dir: /src/packages/admin-server
volumes:
Expand Down
6 changes: 2 additions & 4 deletions packages/admin-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ RUN cd packages/admin-server && \
FROM node:14-alpine

WORKDIR /src
COPY --from=builder /src/packages/admin-server/dist/run-admin.js ./
COPY --from=builder /src/packages/admin-server/dist/index.html ./public/
COPY --from=builder /src/packages/admin-server/dist/_static ./public/_static/
COPY --from=builder /src/packages/admin-server/dist/ ./

ENV NODE_ENV "production"
ENV CONTEMBER_PORT "4000"
ENV CONTEMBER_PUBLIC_DIR "/src/public"
ENV CONTEMBER_S3_ENDPOINT ""
ENV CONTEMBER_S3_PREFIX ""

CMD ["node", "./run-admin.js"]
CMD ["node", "./server/run-admin.js"]
7 changes: 6 additions & 1 deletion packages/admin-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
"name": "@contember/admin-server",
"version": "0.6.52",
"scripts": {
"build": "vite build public --config vite.config.js && esbuild src/run-admin.ts --bundle --sourcemap --platform=node --outdir=dist",
"build": "pnpm run build:public && pnpm run build:server",
"watch": "pnpm run watch:public && pnpm run watch:server",
"build:public": "vite build public --config vite.config.js",
"watch:public": "vite build public --config vite.config.js --watch",
"build:server": "esbuild src/run-admin.ts --bundle --sourcemap --platform=node --outdir=dist/server",
"watch:server": "esbuild src/run-admin.ts --bundle --sourcemap --platform=node --outdir=dist/server --watch ",
"build:api:dev": "exit 0",
"build:api:prod": "exit 0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-server/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default defineConfig({
root: 'public',
build: {
assetsDir: '_static',
outDir: resolve(rootDirectory, `packages/admin-server/dist`),
outDir: resolve(rootDirectory, `packages/admin-server/dist/public`),
rollupOptions: {
input: ['public/index.html', 'public/_panel/index.html'],
treeshake: {
Expand Down

0 comments on commit 5c030f7

Please sign in to comment.