-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: publish docker images for dl-queue
- Loading branch information
1 parent
58b4df7
commit 7c95118
Showing
3 changed files
with
90 additions
and
0 deletions.
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,44 @@ | ||
name: Publish dl-queue | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'dl-queue/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
|
||
- name: set lower case owner name | ||
run: | | ||
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} | ||
env: | ||
OWNER: '${{ github.repository_owner }}' | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./dl-queue/ | ||
push: true | ||
tags: | | ||
ghcr.io/${{ env.OWNER_LC }}/dl-queue:${{ github.sha }} | ||
ghcr.io/${{ env.OWNER_LC }}/dl-queue:latest |
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,3 @@ | ||
.env* | ||
node_modules/ | ||
test/ |
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,43 @@ | ||
# Use an official Node.js runtime as the base image for the build stage | ||
FROM node:14 as build | ||
|
||
# Set the working directory in the Docker image | ||
WORKDIR /usr/src/app | ||
|
||
# Copy package.json and package-lock.json to the working directory | ||
COPY package*.json ./ | ||
|
||
# Install the project dependencies | ||
RUN npm install | ||
|
||
# Copy the rest of the project files to the working directory | ||
COPY . . | ||
|
||
# Compile the TypeScript code | ||
RUN npm run build | ||
|
||
# Start a new stage for the production image | ||
FROM node:14-alpine | ||
|
||
LABEL org.opencontainers.image.source https://github.com/BelgianNoise/dl-utils | ||
|
||
# Set the working directory | ||
WORKDIR /usr/src/app | ||
|
||
# Copy only the built application and the necessary production dependencies from the build stage | ||
COPY --from=build /usr/src/app/dist ./dist | ||
COPY --from=build /usr/src/app/node_modules ./node_modules | ||
|
||
ENV POSTGRES_USERNAME= | ||
ENV POSTGRES_PASSWORD= | ||
ENV POSTGRES_HOST= | ||
ENV POSTGRES_PORT= | ||
ENV POSTGRES_DATABASE= | ||
|
||
ENV AUTH_SECRET= | ||
|
||
# Expose port 3000 for the application | ||
EXPOSE 3000 | ||
|
||
# Start the application | ||
CMD [ "node", "dist/index.js" ] |