Skip to content

Commit

Permalink
Add Support for Dockerfile (#49)
Browse files Browse the repository at this point in the history
* add Dockerfile

* fix src/index.ts not found?

* remove testing phase in Dockerfile

* fix paths

* rewrite Dockerfile

* test edits

* rewrite Dockerfile again

* some edits

* some more edits

* last test for this pr (probably)

* move `discord-api-types` to dependencies and regenerate bun.lockb

* fix start script not found

* update dockerfile

* test again? sigh

* retry in a new day

* minor change

* fix issues

* update README.md

* rename /temp/install -> /temp/uncivserver

* bump version
  • Loading branch information
touhidurrr authored Nov 5, 2024
1 parent 8ca2bab commit c156e24
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,3 @@ package-lock.json
# yarn
yarn.lock

# bun
bun.lockb
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM oven/bun:1 AS base
WORKDIR /usr/touhidurrr/app

# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base AS install
RUN mkdir -p /temp/uncivserver
COPY package.json bun.lockb /temp/uncivserver/
RUN cd /temp/uncivserver && bun install --frozen-lockfile --production

# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM base AS release
COPY --from=install /temp/uncivserver/node_modules node_modules
COPY package.json package.json
COPY tsconfig.json tsconfig.json
COPY public public
COPY src src

# run the app
EXPOSE 1557/tcp
ENTRYPOINT [ "bun", "start" ]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ you can change this behavior setting `PORT` and `HOST` environment variables in
just made. Note that both of these variables are optional.

```bash
bun install
bun install --frozen-lockfile
bun start
```

Expand Down
Binary file added bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uncivserver.xyz",
"version": "4.6.3",
"version": "4.7.0",
"description": "An Open Source, Free to Play, Unciv Multiplayer Server written in Javascript",
"author": "Md. Touhidur Rahman",
"license": "BSD-3-Clause",
Expand Down Expand Up @@ -36,6 +36,7 @@
"@elysiajs/static": "1.0.3",
"bytes": "^3.1.2",
"date-fns": "^4.1.0",
"discord-api-types": "^0.37.103",
"elysia": "^1.1.24",
"ioredis": "^5.4.1",
"lru-cache": "^11.0.2",
Expand All @@ -46,7 +47,6 @@
"@elysiajs/eden": "^1.1.3",
"@types/bun": "^1.1.13",
"@types/bytes": "^3.1.4",
"discord-api-types": "^0.37.103",
"prettier": "^3.3.3",
"typescript": "^5.6.3"
}
Expand Down

0 comments on commit c156e24

Please sign in to comment.