This commit is contained in:
@@ -49,14 +49,11 @@ runs:
|
||||
- name: Create Docker context
|
||||
shell: bash
|
||||
run: |
|
||||
# Remove existing context if it exists
|
||||
docker context rm deploy_target 2>/dev/null || true
|
||||
|
||||
# Create new Docker context
|
||||
docker context create deploy_target \
|
||||
--docker "host=ssh://${{ vars.ssh_user }}@${{ vars.ssh_host }}:${{ vars.ssh_port }}"
|
||||
|
||||
# Verify context works
|
||||
docker --context deploy_target info
|
||||
|
||||
- name: Stop existing deployment
|
||||
@@ -73,14 +70,11 @@ runs:
|
||||
id: deploy
|
||||
shell: bash
|
||||
run: |
|
||||
# Start services
|
||||
docker-compose --context deploy_target -f ${{ inputs.compose_file }} -p ${{ inputs.project_name }} up -d
|
||||
|
||||
# Wait for services to be healthy
|
||||
echo "Waiting for services to start..."
|
||||
sleep 10
|
||||
|
||||
# Get container names
|
||||
CONTAINERS=$(docker-compose --context deploy_target -f ${{ inputs.compose_file }} -p ${{ inputs.project_name }} ps --services | tr '\n' ',' | sed 's/,$//')
|
||||
echo "containers=$CONTAINERS" >> $GITHUB_OUTPUT
|
||||
|
||||
|
||||
11
Dockerfile
11
Dockerfile
@@ -3,14 +3,7 @@
|
||||
FROM oven/bun:1 AS base
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# install dependencies into temp directory
|
||||
# this will cache them and speed up future builds
|
||||
FROM base AS install
|
||||
RUN mkdir -p /temp/dev
|
||||
COPY package.json bun.lock /temp/dev/
|
||||
RUN cd /temp/dev && bun install --frozen-lockfile
|
||||
|
||||
# install with --production (exclude devDependencies)
|
||||
RUN mkdir -p /temp/prod
|
||||
COPY package.json bun.lock /temp/prod/
|
||||
RUN cd /temp/prod && bun install --frozen-lockfile --production
|
||||
@@ -18,14 +11,12 @@ RUN cd /temp/prod && bun install --frozen-lockfile --production
|
||||
# copy node_modules from temp directory
|
||||
# then copy all (non-ignored) project files into the image
|
||||
FROM base AS prerelease
|
||||
COPY --from=install /temp/dev/node_modules node_modules
|
||||
COPY --from=install /temp/prod/node_modules node_modules
|
||||
COPY . .
|
||||
|
||||
# build
|
||||
ENV NODE_ENV=production
|
||||
RUN bun --bun run build
|
||||
|
||||
# copy production dependencies and source code into final image
|
||||
FROM base AS release
|
||||
COPY --from=install /temp/prod/node_modules node_modules
|
||||
COPY --from=prerelease /usr/src/app/build .
|
||||
|
||||
Reference in New Issue
Block a user