Skip to content

Commit 3822978

Browse files
committed
build: update docker build
1 parent 587ba73 commit 3822978

File tree

3 files changed

+42
-8
lines changed

3 files changed

+42
-8
lines changed

Diff for: .github/workflows/docker-build-push.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
with:
3737
image_name: proompteng
3838
dockerfile: ./apps/proompteng/Dockerfile
39-
context: ./apps/proompteng
39+
context: .
4040
new_tag: ${{ needs.version.outputs.new_tag }}
4141
secrets:
4242
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}

Diff for: apps/proompteng/Dockerfile

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
FROM oven/bun:latest AS deps
1+
FROM node:lts-alpine AS deps
22
WORKDIR /app
3-
COPY package.json bun.lockb .npmrc ./
4-
RUN bun install --frozen-lockfile
3+
COPY package.json pnpm-lock.yaml .npmrc ./
4+
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
5+
RUN corepack enable
6+
RUN pnpm install --frozen-lockfile
57

68
FROM node:lts-alpine AS builder
79
WORKDIR /app
810
COPY --from=deps /app/node_modules ./node_modules
11+
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
12+
RUN corepack enable
913
COPY . .
10-
RUN npm run build
14+
RUN pnpm build
1115

1216
FROM node:lts-alpine AS runner
1317
WORKDIR /app
@@ -18,9 +22,9 @@ ENV NEXT_TELEMETRY_DISABLED=1
1822
RUN addgroup --system --gid 1001 nodejs && \
1923
adduser --system --uid 1001 nextjs
2024

21-
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
22-
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
23-
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
25+
COPY --from=builder --chown=nextjs:nodejs /app/apps/proompteng/.next/standalone /app
26+
COPY --from=builder --chown=nextjs:nodejs /app/apps/proompteng/.next/static /app/apps/proompteng/.next/static
27+
COPY --from=builder --chown=nextjs:nodejs /app/apps/proompteng/public /app/apps/proompteng/public
2428

2529
USER nextjs
2630

@@ -29,4 +33,5 @@ EXPOSE 3000
2933
ENV PORT=3000
3034
ENV HOSTNAME="0.0.0.0"
3135

36+
WORKDIR /app/apps/proompteng
3237
CMD ["node", "server.js"]

Diff for: scripts/build-proompteng.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
# Set variables
4+
IMAGE_NAME="kalmyk.duckdns.org/lab/proompteng"
5+
DOCKERFILE="apps/proompteng/Dockerfile"
6+
CONTEXT_PATH="."
7+
8+
# Check if a tag is provided as an argument
9+
if [ $# -eq 1 ]; then
10+
TAG=$1
11+
else
12+
# If no tag is provided, use the current date and time
13+
TAG=$(date +"%Y%m%d_%H%M%S")
14+
fi
15+
16+
# Full image name with tag
17+
FULL_IMAGE_NAME="${IMAGE_NAME}:${TAG}"
18+
19+
# Build the Docker image
20+
echo "Building Docker image: ${FULL_IMAGE_NAME}"
21+
docker buildx build --platform linux/arm64 -t ${FULL_IMAGE_NAME} -f ${DOCKERFILE} ${CONTEXT_PATH} --push
22+
23+
# Check if the build was successful
24+
if [ $? -eq 0 ]; then
25+
echo "Docker image built and pushed successfully: ${FULL_IMAGE_NAME}"
26+
else
27+
echo "Docker image build or push failed"
28+
exit 1
29+
fi

0 commit comments

Comments
 (0)