From 38e9027d093151d70a267c3a1a1e77f2a9e6a618 Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Mon, 26 Feb 2024 13:42:32 +0000 Subject: [PATCH] Update --- Docker/Dockerfile | 4 ++-- Makefile | 33 +++++++++++++++++++++++++++++++++ server.js | 8 ++++++-- 3 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 Makefile diff --git a/Docker/Dockerfile b/Docker/Dockerfile index 3ee8588..5751ad4 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -11,9 +11,9 @@ COPY ./dist /app/dist COPY ./server /app/server -copy ./db /app/db +copy ./menu.db /app/db/ -RUN pnpm install +RUN npm install # RUN ls -lh . diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1595f9b --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +PROJECT = menuserver + +VERSION = latest + + +ECR_REPO = git.caliban.io/martin +# APP_IMAGE = 482681734622.dkr.ecr.eu-west-1.amazonaws.com/$(PROJECT):$(VERSION) +APP_IMAGE = $(ECR_REPO)/$(PROJECT):$(VERSION) +# APP_IMAGE = $(PROJECT):$(VERSION) +NO_CACHE = true + +.PHONY: build +build: + +# docker build ./docker/. -t $(APP_IMAGE) --build-arg VERSION=$(VERSION) --no-cache=$(NO_CACHE) --compress=true + docker build --platform linux/amd64 --no-cache -force-rm --tag ${APP_IMAGE} --file ./Docker/Dockerfile . + + +#push docker image to registry +.PHONY: push +push: build + docker push $(APP_IMAGE) + + +#push docker image to registry +.PHONY: run +run: build + docker run $(APP_IMAGE) + +ver: + @echo '$(VERSION)' + #echo $ERSION +.PHONY: ver \ No newline at end of file diff --git a/server.js b/server.js index 9b428a6..920dd96 100644 --- a/server.js +++ b/server.js @@ -23,7 +23,7 @@ app.use(session({ 'saveUninitialized': true })); app.get('/', (request, response) => { - if (request.session.auth) + /* if (request.session.auth) response.redirect('/menu'); else if (!localHost) @@ -33,7 +33,11 @@ app.get('/', (request, response) => { request.session.username = 'martin'; request.session.auth = 'jhgkjgkjhgkjhgjkhgjkhgfhghfjgfjhgf'; response.redirect('/menu'); - } + }*/ + + request.session.username = 'martin'; + request.session.auth = 'jhgkjgkjhgkjhgjkhgjkhgfhghfjgfjhgf'; + response.redirect('/menu'); }); app.get('/menu', checkAuth, (req, res) => { res.sendFile(path.join(`${__dirname}/dist/index.html`));