-
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.
feat: github actions to build and pushes an image to the package repo
- Loading branch information
Showing
3 changed files
with
74 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/[email protected] | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
file: ./Dockerfile.dev | ||
push: true | ||
tags: ghcr.io/clue355/github_dev:dev |
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,45 @@ | ||
# Specifies Node Version 18.18.2 & Alpine Linux Version 3.18 OS | ||
FROM node:18.18.2-alpine3.18 | ||
|
||
# Application Container Root Directory | ||
WORKDIR /app | ||
|
||
# install pnpm globally inside container only | ||
RUN npm install -g pnpm | ||
|
||
# Copy dependency version files first to utilize dockers layer dependency caching | ||
COPY package.json pnpm-lock.yaml ./ | ||
|
||
# install dependencies | ||
RUN pnpm install | ||
|
||
# Copy everything from the current DIR to the container DIR | ||
COPY . . | ||
|
||
# Starts the project | ||
CMD ["pnpm", "run", "dev"] | ||
|
||
# Specifies the port the container listens to | ||
EXPOSE 3000 | ||
|
||
## build docker file and run in dev mode | ||
|
||
# docker build -f Dockerfile.dev -t your-image-name . | ||
# docker run --name container_name -p 3000:3000 -v $(pwd):/app image_name | ||
|
||
# Follow the real time logs again after stopping and starting the container | ||
# docker logs -f container_name | ||
|
||
# project link: http://localhost:3000/ | ||
|
||
# or | ||
|
||
## build docker file and run in production mode | ||
|
||
# docker build -f Dockerfile.prod -t your-image-name . | ||
# docker run --name container_name -p 3000:3000 your-image-name | ||
|
||
# Follow the real time logs again after stopping and starting the container | ||
# docker logs -f container_name | ||
|
||
# project link: http://localhost:3000/ |
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