add Dockerfile and tweak deployment instructions
This commit is contained in:
@@ -25,9 +25,9 @@ INFURA_PROJECT_ID=???
|
|||||||
# default is https://test-image.timesafari.app
|
# default is https://test-image.timesafari.app
|
||||||
#DOWNLOAD_IMAGE_SERVER=test-image.timesafari.app
|
#DOWNLOAD_IMAGE_SERVER=test-image.timesafari.app
|
||||||
|
|
||||||
# default is 3000
|
# default is 3002
|
||||||
#PORT=3000
|
#PORT=3000
|
||||||
|
|
||||||
# default is jdbc:sqlite:./sqlite-db.sqlite
|
# default is ./image.sqlite
|
||||||
# file name also referenced in flyway.conf and in code
|
# file name also referenced in flyway.conf and in code
|
||||||
#SQLITE_FILE=./image-db.sqlite
|
#SQLITE_FILE=./image.sqlite
|
||||||
|
|||||||
13
Dockerfile
Normal file
13
Dockerfile
Normal 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
|
||||||
@@ -39,13 +39,16 @@ JWT=`node -e "$CODE"`; curl -X DELETE -H "Authorization: Bearer $JWT" http://loc
|
|||||||
|
|
||||||
## deploy to prod first time
|
## 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.
|
* 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
|
## 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.
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
|
||||||
"name": "Images for Trade",
|
"name": "Images for Trade",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ require('dotenv').config()
|
|||||||
const app = express();
|
const app = express();
|
||||||
app.use(cors());
|
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
|
// 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 bucketName = process.env.S3_BUCKET_NAME || 'gifts-image-test';
|
||||||
const imageServer = process.env.DOWNLOAD_IMAGE_SERVER || 'test-image.timesafari.app';
|
const imageServer = process.env.DOWNLOAD_IMAGE_SERVER || 'test-image.timesafari.app';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user