Skip to content

Commit

Permalink
Fix users image asset ignore mode
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejearley committed Mar 15, 2023
1 parent 890e244 commit 793e250
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 249 deletions.
12 changes: 0 additions & 12 deletions common/exchange/package.json

This file was deleted.

201 changes: 0 additions & 201 deletions common/exchange/src/index.ts

This file was deleted.

21 changes: 0 additions & 21 deletions common/exchange/tsconfig.json

This file was deleted.

11 changes: 5 additions & 6 deletions infrastructure/cdk/src/providers/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ import * as ecs from 'aws-cdk-lib/aws-ecs'
import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns'
import { UsersStackProps } from '../interfaces/StackProps'
import { Config } from './config'
import path from 'path'

/**
* Users API stack
*/
export class UsersStack extends cdk.Stack {
/** Stack name */
public readonly name = 'users'
/** Path to monorepo root */
public readonly contextPath = '../../'
/** Path to stack build assets or Dockerfile */
public readonly assetPath = 'services/users/Dockerfile'
/** Path to stack build context */
public readonly contextPath = '../../'

constructor(scope: Construct, id: string, props: UsersStackProps) {
super(scope, id, props)
Expand All @@ -27,10 +26,10 @@ export class UsersStack extends cdk.Stack {

/** Create Docker image asset */
const imageAsset = new ecrAssets.DockerImageAsset(this, config.getFullStackResourceName(this.name, 'image'), {
directory: path.resolve(this.contextPath),
directory: this.contextPath,
file: this.assetPath,
exclude: ['cdk.out'],
platform: ecrAssets.Platform.LINUX_AMD64
platform: ecrAssets.Platform.LINUX_AMD64,
ignoreMode: cdk.IgnoreMode.GIT
})

/** Create a load-balanced service for the users express API */
Expand Down
21 changes: 12 additions & 9 deletions services/users/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
# Note: This Dockerfile assumes context is set to the git root (../../)

# Use Node 18 Alpine as the base image
FROM node:18-alpine

# Set the working directory to /app
WORKDIR /app
# Set the working directory to /tmp
WORKDIR /tmp

# Copy package.json to the working directory
COPY package.json ./
# Copy files to the working directory
COPY . .

# Install the dependencies
RUN npm install

# Copy the rest of the files to the working directory
COPY . .

# Build the TypeScript project
RUN npm run build --workspace @casimir/users

# Set the working directory to /app
WORKDIR /app

# Copy the build assets to the working directory
COPY /tmp/services/users/dist .

# Expose port 4000
EXPOSE 4000

WORKDIR /app/services/users/dist

# Run the app when the container launches
CMD ["node", "index.js"]

0 comments on commit 793e250

Please sign in to comment.