Skip to content

Commit

Permalink
fix(docker): updated
Browse files Browse the repository at this point in the history
  • Loading branch information
jhderojasUVa committed Aug 16, 2022
1 parent 68bae25 commit 8e79fd4
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
// jest
'plugin:jest/recommended',
// Sky standard configuration for JS
'@sky-uk/eslint-config-sky/packages/eslint-config-sky',
//'@sky-uk/eslint-config-sky/packages/eslint-config-sky',
// standard prettier
'prettier',
// recommended for Cypress
Expand All @@ -34,4 +34,4 @@ module.exports = {
'jest/valid-expect-in-promise': 'warn',
},
ignorePatterns: ['.cache', 'coverage', 'dist', 'node_modules', 'tools/fixtures/'],
};
};
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ WORKDIR /usr/src/app
COPY . .
RUN npm install

LABEL org.opencontainers.image.source https://github.com/jhderojasUVa/analyted-backend-todo

EXPOSE 8080
CMD [ "node", "./src/index.js" ]
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ For running:
- `npm run docker:run`. To run the latest versions
- `npm run docker:run <version>`. To run the a concrete version

For pulling (**You need to be logged in and with rights to do it**):
For pulling:

- `npm run docker:pull`. To run the latest versions
- `npm run docker:pull <version>`. To run the a concrete version

For pushing (**You need to be logged in and with rights to do it**):

- `npm run docker:push`. To run the latest versions
- `npm run docker:push <version>`. To run the a concrete version
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"docker:login": "docker login ghcr.io",
"docker:build": "./scripts/docker-build.sh",
"docker:push": "./scripts/docker-push.sh",
"docker:pull": "./scripts/docker-pull.sh",
"docker:run": "./scripts/docker-run.sh",
"server": "node ./src/index.js",
Expand Down
4 changes: 2 additions & 2 deletions scripts/docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VERSION=$1
# If you don't say the version it will build the latest always
if [ -z "$1" ]
then
docker build -t ghcr.io/analyted-backend:$1 .
docker build -t ghcr.io/jhderojasuva/analyted-backend-todo/analyted-backend:$1 .
else
docker build -t ghcr.io/analyted-backend:latest .
docker build -t ghcr.io/jhderojasuva/analyted-backend-todo/analyted-backend:latest .
fi
4 changes: 2 additions & 2 deletions scripts/docker-pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ VERSION=$1
# Remember that you must be login in
if [ -z "$1" ]
then
docker pull ghcr.io/analyted-backend:$1
docker pull ghcr.io/jhderojasuva/analyted-backend-todo/analyted-backend:$1
else
docker pull ghcr.io/analyted-backend:latest
docker pull ghcr.io/jhderojasuva/analyted-backend-todo/analyted-backend:latest
fi
14 changes: 14 additions & 0 deletions scripts/docker-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
## Get version
VERSION=$1

## This script push on container registry
# Remember that you must be login in
if [ -z "$1" ]
then
docker image tag ghcr.io/jhderojasuva/analyted-backend-todo/analyted-backend:$1 ghcr.io/jhderojasuva/analyted-backend-todo/analyted-backend:$1
docker push ghcr.io/jhderojasuva/analyted-backend-todo/analyted-backend:$1
else
docker image tag ghcr.io/jhderojasuva/analyted-backend-todo/analyted-backend:$1 ghcr.io/jhderojasuva/analyted-backend-todo/analyted-backend:latest
docker push ghcr.io/jhderojasuva/analyted-backend-todo/analyted-backend:latest
fi
4 changes: 2 additions & 2 deletions scripts/docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VERSION=$1
# If you don't say the version it will always run the latest
if [ -z "$1" ]
then
docker run --name analyted-backend --network analyted_network -p 8080:8080 -d ghcr.io/analyted-backend:$1
docker run --name analyted-backend --network analyted_network -p 8080:8080 -d ghcr.io/jhderojasuva/analyted-backend-todo/analyted-backend:$1
else
docker run --name analyted-backend --network analyted_network -p 8080:8080 -d ghcr.io/analyted-backend:latest
docker run --name analyted-backend --network analyted_network -p 8080:8080 -d ghcr.io/jhderojasuva/analyted-backend-todo/analyted-backend:latest
fi

0 comments on commit 8e79fd4

Please sign in to comment.