Skip to content

Commit 8cabe64

Browse files
authored
Merge pull request #249 from UW-Macrostrat/fix-build
Fix Docker build
2 parents 3c59a81 + f7e8bb2 commit 8cabe64

File tree

12 files changed

+337
-70
lines changed

12 files changed

+337
-70
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
.yarn/cache
2+
.yarn/unplugged
3+
.yarn/install-state.gz
14
node_modules
5+
.pnp.*

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ ELEVATION_DATABASE=<database_url>
99
ALICE_DATABASE=<database_url>
1010
ROCKD_DATABASE=<database_url>
1111
WHOS_ON_FIRST_DATABASE=<database_url>
12+
13+
# Settings for debugging
14+
NODE_ENV=development
15+
DEBUG=*
16+
PORT=5002

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,9 @@ Icon
2828
.Spotlight-V100
2929
.Trashes
3030
.yarn/install-state.gz
31+
.yarn/cache
32+
.yarn/unplugged
3133

3234
.env
35+
.pnp.*
36+

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.yarn
22
node_modules
3+
.pnp.*

.yarnrc.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
nodeLinker: node-modules
2-
31
yarnPath: .yarn/releases/yarn-4.9.1.cjs

Dockerfile

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,11 @@ RUN apt-get -y update && \
88

99
WORKDIR /code
1010

11-
COPY ./package.json ./yarn.lock ./code/
11+
COPY package.json yarn.lock .yarnrc.yml /code/
12+
COPY .yarn/releases /code/.yarn/releases
1213

1314
RUN yarn install
1415

15-
# We had to switch to native postgres bindings
16-
# (using the pg-native module) for the purposes
17-
# of building in Docker. I think this is necessary
18-
# to support Postgres v14, but it will make things harder
19-
# to build/run on weird platforms.
20-
# https://github.com/brianc/node-postgres/issues/1508
21-
ENV NODE_PG_FORCE_NATIVE=1
22-
2316
COPY ./ /code/
2417

2518
COPY ./supervisor/api.conf /etc/supervisor/conf.d/

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@macrostrat/api-v2",
3-
"version": "2.1.0-beta.1",
3+
"version": "2.1.0-beta.2",
44
"description": "An API for stratigraphic and geological information (Version 2).",
55
"main": "server.js",
66
"repository": {
@@ -53,18 +53,18 @@
5353
"geojson-precision": "^0.4.0",
5454
"image-size": "^0.5.0",
5555
"mapshaper": "^0.3.20",
56-
"memory-cache": "^0.1.4",
56+
"memory-cache": "^0.2.0",
5757
"microtime": "^3.0.0",
5858
"multiline": "^1.0.2",
59-
"mysql": "2.7.x",
60-
"pg": "^8.7.1",
61-
"pg-native": "^3.0.0",
59+
"pg": "^8.15.6",
60+
"pg-native": "^3.4.5",
6261
"portscanner": "^1.0.0",
6362
"redis": "^2.4.2",
6463
"tilestrata": "^2.0.1",
6564
"tilestrata-dependency": "^0.4.0",
6665
"topojson": "^1.6.19",
6766
"ts-node": "^10.9.2",
67+
"tsx": "^4.19.3",
6868
"turf-area": "^1.1.1",
6969
"turf-buffer": "^1.0.4",
7070
"turf-point": "^0.1.6",

server.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
const dotenv = require("dotenv");
2+
// Load environment variables from .env file
3+
dotenv.config();
4+
5+
console.log(process.env.PORT)
6+
17
var express = require("express"),
28
bodyParser = require("body-parser"),
39
//v1 = require("./v1"),
@@ -61,7 +67,7 @@ app.use("/", v2);
6167
app.set("json spaces", 2);
6268

6369
//TODO: update port to designated env.
64-
app.port = process.argv[2] || 5000;
70+
app.port = process.argv[2] ?? process.env.PORT ?? 5000;
6571

6672
app.start = function () {
6773
app.listen(app.port, function () {

supervisor/api.conf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[program:api]
2-
command = npm start
2+
directory = /code
3+
user = root
4+
command = yarn start 5000
35
autorestart = true
46
stdout_logfile = /dev/stdout
57
stdout_logfile_maxbytes = 0

v2/credentials.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
const dotenv = require("dotenv");
2-
// Load environment variables from .env file
3-
dotenv.config();
4-
51
// Set up debug mode if needed
62
exports.debug = process.env.NODE_ENV === "development";
73
if (exports.debug) {

0 commit comments

Comments
 (0)