https://github.com/cutenode/xkcd-to-azure
Auto-deploy a Dockerized application to Azure
https://github.com/cutenode/xkcd-to-azure
app azure express node nodejs web xkcd
Last synced: 2 months ago
JSON representation
Auto-deploy a Dockerized application to Azure
- Host: GitHub
- URL: https://github.com/cutenode/xkcd-to-azure
- Owner: cutenode
- License: mit
- Created: 2019-03-05T21:55:35.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-09T03:48:06.000Z (over 6 years ago)
- Last Synced: 2025-09-24T23:41:54.757Z (9 months ago)
- Topics: app, azure, express, node, nodejs, web, xkcd
- Language: JavaScript
- Size: 72.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# What have we done in this step
We've Dockerized!
The first step was adding a new npm script, `start`, which can be run to start our app via npm. We've added this as a tiny touch of developer expereince.
Next, we went ahead and created `Dockerfile` and `.dockerignore`. In the dockerfile we've scaffolded out an extremely basic setup:
**Dockerfile:**
- Use the latest Node.js LTS with Alpine Linux
- Create an application directory
- Copy over the `package.json` and `package-lock.json` from the current directory
- Run `npm ci` to install dependencies rapidly
- Copy the dependencies into the app directory
- Run `npm start`
**.dockerignore:**
- Ignore `node_modules`
- Ignore npm's debug file
Next, we'll _need_ to run a command to actually build the Docker image from the `Dockerfile`. To do this, run the following command after replacing `` with your [Docker Hub](https://hub.docker.com/) username:
```bash
docker build -t /step-by-step-express .
```
It's worth noting that `/step-by-step-express` can be any string – this is just the one I've decided to use personally, as it's more easily identifyable. You're not required to include your Docker Hub username nor the repo/project name, but this does seem to be the naming convention the Docker community has standardized on.
From there, we'll want to run the Docker image, publshing (`-p`) port 8080 and running it in detached mode (`-d`). You'll need to have Docker locally installed for this step!
```bash
docker run -p 8080:8080 -d /step-by-step-express
```
Next, you're going to want to publish this image to Docker Hub – this just requires a few steps:
```bash
docker login # log in with your Docker Hub credentials
```
```bash
docker push /step-by-step-express
```