-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,48 @@ | ||
Base docker image for gravity-ui projects | ||
|
||
# Docker nodejs | ||
|
||
Ubuntu based docker image with nginx and nodejs. | ||
|
||
## Usage example | ||
|
||
See example docker files in [examples folder](./examples). | ||
|
||
## Push image to container registry | ||
|
||
Images now are saved in [Github container registry](https://github.com/orgs/gravity-ui/packages/container/package/node-nginx). | ||
|
||
To push new image to registry you need to do: | ||
|
||
0. Install docker | ||
|
||
1. Switch on main branch | ||
|
||
`git checkout main` | ||
|
||
2. Login | ||
|
||
- Create [Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) with permissions `read:packages` and `write:packages` | ||
|
||
- Save token to env variable: | ||
|
||
```bash | ||
export CR_PAT=<TOKEN> | ||
``` | ||
|
||
- Login in registry: | ||
|
||
```bash | ||
echo $CR_PAT | docker login ghcr.io -u gravity-ui --password-stdin | ||
``` | ||
|
||
3. Build new image | ||
|
||
`docker build . --tag gravity-ui/node-nginx:latest` | ||
|
||
4. Tag image | ||
|
||
`docker image tag gravity-ui/node-nginx ghcr.io/gravity-ui/node-nginx:ubuntu20-nodejs18` | ||
|
||
5. Push image | ||
|
||
`docker image push ghcr.io/gravity-ui/node-nginx:ubuntu20-nodejs18` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#Example for nodejs project with nginx and supervisor | ||
FROM ghcr.io/gravity-ui/node-nginx:ubuntu20-nodejs18 | ||
|
||
RUN mkdir -p /opt/app | ||
|
||
WORKDIR /opt/app | ||
|
||
COPY package.json package-lock.json /opt/app/ | ||
|
||
RUN npm i -g npm@latest | ||
RUN npm ci | ||
|
||
COPY . . | ||
COPY ./deploy/nginx /etc/nginx | ||
COPY ./deploy/supervisor/ /etc/supervisor/conf.d | ||
|
||
RUN npm run build && \ | ||
rm -rf deploy tests /tmp/* /root/.npm && \ | ||
chown app /opt/app/dist/run | ||
|
||
EXPOSE 80 | ||
|
||
CMD ["/usr/bin/supervisord"] |