add Dockerfile and tweak deployment instructions

This commit is contained in:
2024-04-08 19:19:37 -06:00
parent e878665943
commit 6cd4a5a988
5 changed files with 25 additions and 8 deletions

View File

@@ -25,9 +25,9 @@ INFURA_PROJECT_ID=???
# default is https://test-image.timesafari.app
#DOWNLOAD_IMAGE_SERVER=test-image.timesafari.app
# default is 3000
# default is 3002
#PORT=3000
# default is jdbc:sqlite:./sqlite-db.sqlite
# default is ./image.sqlite
# file name also referenced in flyway.conf and in code
#SQLITE_FILE=./image-db.sqlite
#SQLITE_FILE=./image.sqlite

13
Dockerfile Normal file
View File

@@ -0,0 +1,13 @@
# syntax=docker/dockerfile:1
FROM node:21-alpine
ARG IMAGE_API_VERSION
RUN npm install -g pnpm
RUN apk add git
RUN git clone https://gitea.anomalistdesign.com/log-trade/image-api.git
WORKDIR image-api
RUN git checkout $IMAGE_API_VERSION
RUN pnpm install --prod
CMD node server.js

View File

@@ -39,13 +39,16 @@ JWT=`node -e "$CODE"`; curl -X DELETE -H "Authorization: Bearer $JWT" http://loc
## deploy to prod first time
* Do the necessary steps from "setup" above.
* Do the necessary steps from "setup" above, or `docker build` it.
* In object storage, set up bucket and erase any test data.
* In object storage, set up bucket (and erase any test data).
* Create a cert for the image delivery & image API servers.
* In haproxy, set a permanent web forward to the correct storage location.
* eg. `http-request redirect code 301 location https://a2-west.americancloud.com/images6618:giftsimagetest%[capture.req.uri] if { hdr_dom(host) -i test-image.timesafari.app }`
## deploy to prod subsequent times
* Add CHANGELOG.md entry. Update version in server.js file.
* Update version in server.js file. Add CHANGELOG.md entry.

View File

@@ -1,4 +1,5 @@
{
"name": "Images for Trade",
"version": "0.0.1",
"description": "",

View File

@@ -16,9 +16,9 @@ require('dotenv').config()
const app = express();
app.use(cors());
const port = process.env.PORT || 3001;
const port = process.env.PORT || 3002;
// file name also referenced in flyway.conf and potentially in .env files or in environment variables
const dbFile = process.env.SQLITE_FILE || './image-db.sqlite';
const dbFile = process.env.SQLITE_FILE || './image.sqlite';
const bucketName = process.env.S3_BUCKET_NAME || 'gifts-image-test';
const imageServer = process.env.DOWNLOAD_IMAGE_SERVER || 'test-image.timesafari.app';