Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 43 additions & 6 deletions .github/workflows/build-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,51 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Using nodejs v18
- uses: actions/checkout@v6

- name: Install pnpm
uses: pnpm/action-setup@v5
with:
package_json_file: ./mapsync-server/package.json
cache_dependency_path: ./mapsync-server/pnpm-lock.yaml

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "18"
- run: npm install
node-version: "24"
cache: "pnpm"
cache-dependency-path: ./mapsync-server/pnpm-lock.yaml

- name: Install deps
run: pnpm install
working-directory: ./mapsync-server
- run: npm run build

- name: Build
run: pnpm run build
working-directory: ./mapsync-server

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Install pnpm
uses: pnpm/action-setup@v5
with:
package_json_file: ./mapsync-server/package.json
cache_dependency_path: ./mapsync-server/pnpm-lock.yaml

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: ./mapsync-server/.nvmrc
cache: "pnpm"
cache-dependency-path: ./mapsync-server/pnpm-lock.yaml

- name: Install deps
run: pnpm install
working-directory: ./mapsync-server
- run: npm run test

- name: Test
run: pnpm run test
working-directory: ./mapsync-server
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@v6

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand Down
32 changes: 22 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
# base is shared between build/test and deploy
FROM node:18-alpine AS base
FROM node:24-alpine AS base

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

WORKDIR /usr/src/app/

# contains various scripts, so include in all images
COPY ./mapsync-server/package.json /usr/src/app/package.json
## so corepack knows pnpm's version
COPY ./mapsync-server/package.json ./mapsync-server/pnpm-lock.yaml ./mapsync-server/pnpm-workspace.yaml ./
## prevent prompt to download
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
## enable corepack and pnpm
RUN corepack enable
## setup for offline
RUN corepack pack
## don't call out to network anymore
ENV COREPACK_ENABLE_NETWORK=0

FROM base AS build
FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

COPY ./mapsync-server/package-lock.json /usr/src/app/package-lock.json
RUN npm install
FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile

# copy source as late as possible, to reuse docker cache with node_modules
COPY ./mapsync-server /usr/src/app
RUN npm run build
RUN pnpm run build

FROM build AS test
RUN npm run test
RUN pnpm run test

# final image only includes minimal files
FROM base AS deploy

COPY --from=build /usr/src/app/node_modules /usr/src/app/node_modules
COPY --from=prod-deps /usr/src/app/node_modules /usr/src/app/node_modules
COPY --from=build /usr/src/app/dist /usr/src/app/dist

ENV NODE_ENV=production
Expand All @@ -33,4 +45,4 @@ ENV MAPSYNC_DATA_DIR=/data

EXPOSE 12312/tcp

CMD [ "npm", "start" ]
CMD [ "pnpm", "start" ]
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.8"

services:
map-sync:
image: mapsync-img
Expand Down
1 change: 1 addition & 0 deletions mapsync-server/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
6 changes: 3 additions & 3 deletions mapsync-server/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MapSync Server

This server is written for nodejs v18. Use [nvm](https://github.com/nvm-sh/nvm) to easily switch to this version:
This server is written for nodejs v24. Use [nvm](https://github.com/nvm-sh/nvm) to easily switch to this version:

- `nvm install 18`
- `nvm use 18`
- `nvm install 24`
- `nvm use 24`
Loading