set docker context
This commit is contained in:
parent
5ede8a8bcc
commit
2981a383d2
22 changed files with 49 additions and 34 deletions
|
@ -1,8 +1,8 @@
|
|||
FROM ghcr.io/immich-app/base-server-dev:20231109 as builder
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
COPY cli/package.json cli/package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY . .
|
||||
COPY cli .
|
||||
|
||||
|
||||
FROM builder as prod
|
||||
|
@ -18,12 +18,12 @@ ENV NODE_ENV=production
|
|||
COPY --from=prod /usr/src/app/node_modules ./node_modules
|
||||
COPY --from=prod /usr/src/app/dist ./dist
|
||||
COPY --from=prod /usr/src/app/bin ./bin
|
||||
COPY ./assets ./assets
|
||||
COPY server/assets ./assets
|
||||
|
||||
COPY LICENSE /licenses/LICENSE.txt
|
||||
COPY LICENSE /LICENSE
|
||||
COPY package.json package-lock.json ./
|
||||
COPY start*.sh ./
|
||||
COPY server/package.json server/package-lock.json ./
|
||||
COPY server/start*.sh ./
|
||||
|
||||
RUN npm link && npm cache clean --force
|
||||
VOLUME /usr/src/app/upload
|
||||
|
|
|
@ -19,7 +19,7 @@ describe(`CLI (e2e)`, () => {
|
|||
let apiKey: APIKeyCreateResponseDto;
|
||||
|
||||
beforeAll(async () => {
|
||||
[server] = await testApp.create({ jobs: true });
|
||||
server = (await testApp.create({ jobs: true })).getHttpServer();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
@ -48,5 +48,11 @@ describe(`CLI (e2e)`, () => {
|
|||
const assets = await api.assetApi.getAllAssets(server, admin.accessToken);
|
||||
expect(assets.length).toBeGreaterThan(4);
|
||||
});
|
||||
|
||||
it('should create album from folder name', async () => {
|
||||
await new Upload().run([`${IMMICH_TEST_ASSET_PATH}/albums/nature/`], { recursive: true, album: true });
|
||||
const albums = await api.albumApi.getAllAlbums(server, admin.accessToken);
|
||||
expect(albums.length).toEqual(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"globalSetup": "<rootDir>/../server/test/e2e/setup.ts",
|
||||
"testEnvironment": "node",
|
||||
"testRegex": ".e2e-spec.ts$",
|
||||
"testTimeout": 120000,
|
||||
"testTimeout": 60000,
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
},
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import setup from '../../../server/test/e2e/setup';
|
||||
|
||||
export default async () => {
|
||||
// Call server e2e setup
|
||||
await setup();
|
||||
};
|
|
@ -6,8 +6,8 @@ services:
|
|||
immich-cli:
|
||||
image: immich-cli-dev:latest
|
||||
build:
|
||||
context: ../cli
|
||||
dockerfile: Dockerfile
|
||||
context: ../
|
||||
dockerfile: cli/Dockerfile
|
||||
target: builder
|
||||
command: npm run test:e2e
|
||||
volumes:
|
||||
|
|
|
@ -20,4 +20,9 @@ export const albumApi = {
|
|||
expect(res.status).toEqual(200);
|
||||
return res.body as AlbumResponseDto;
|
||||
},
|
||||
getAllAlbums: async (server: any, accessToken: string) => {
|
||||
const res = await request(server).get(`/album/`).set('Authorization', `Bearer ${accessToken}`).send();
|
||||
expect(res.status).toEqual(200);
|
||||
return res.body as AlbumResponseDto[];
|
||||
},
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@ describe(`${ActivityController.name} (e2e)`, () => {
|
|||
let nonOwner: LoginResponseDto;
|
||||
|
||||
beforeAll(async () => {
|
||||
[server] = await testApp.create();
|
||||
server = (await testApp.create()).getHttpServer();
|
||||
await testApp.reset();
|
||||
await api.authApi.adminSignUp(server);
|
||||
admin = await api.authApi.adminLogin(server);
|
||||
|
|
|
@ -24,7 +24,7 @@ describe(`${AlbumController.name} (e2e)`, () => {
|
|||
let user2Albums: AlbumResponseDto[];
|
||||
|
||||
beforeAll(async () => {
|
||||
[server] = await testApp.create();
|
||||
server = (await testApp.create()).getHttpServer();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
|
|
@ -83,7 +83,8 @@ describe(`${AssetController.name} (e2e)`, () => {
|
|||
};
|
||||
|
||||
beforeAll(async () => {
|
||||
[server, app] = await testApp.create();
|
||||
app = await testApp.create();
|
||||
server = app.getHttpServer();
|
||||
assetRepository = app.get<IAssetRepository>(IAssetRepository);
|
||||
|
||||
await testApp.reset();
|
||||
|
|
|
@ -39,8 +39,7 @@ describe(`${AuthController.name} (e2e)`, () => {
|
|||
let accessToken: string;
|
||||
|
||||
beforeAll(async () => {
|
||||
await testApp.reset();
|
||||
[server] = await testApp.create();
|
||||
server = (await testApp.create()).getHttpServer();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
|
|
@ -168,7 +168,7 @@ describe(`Supported file formats (e2e)`, () => {
|
|||
const testsToRun = formatTests.filter((formatTest) => formatTest.runTest);
|
||||
|
||||
beforeAll(async () => {
|
||||
[server] = await testApp.create({ jobs: true });
|
||||
server = (await testApp.create({ jobs: true })).getHttpServer();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
|
8
server/test/e2e/immich-e2e-config.json
Normal file
8
server/test/e2e/immich-e2e-config.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"reverseGeocoding": {
|
||||
"enabled": false
|
||||
},
|
||||
"machineLearning": {
|
||||
"enabled": false
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ describe(`${LibraryController.name} (e2e)`, () => {
|
|||
let admin: LoginResponseDto;
|
||||
|
||||
beforeAll(async () => {
|
||||
[server] = await testApp.create({ jobs: true });
|
||||
server = (await testApp.create({ jobs: true })).getHttpServer();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
|
|
@ -8,7 +8,7 @@ describe(`${OAuthController.name} (e2e)`, () => {
|
|||
let server: any;
|
||||
|
||||
beforeAll(async () => {
|
||||
[server] = await testApp.create();
|
||||
server = (await testApp.create()).getHttpServer();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
|
|
@ -12,7 +12,7 @@ describe(`${PartnerController.name} (e2e)`, () => {
|
|||
let user3: LoginResponseDto;
|
||||
|
||||
beforeAll(async () => {
|
||||
[server] = await testApp.create();
|
||||
server = (await testApp.create()).getHttpServer();
|
||||
|
||||
await testApp.reset();
|
||||
await api.authApi.adminSignUp(server);
|
||||
|
|
|
@ -17,7 +17,8 @@ describe(`${PersonController.name}`, () => {
|
|||
let hiddenPerson: PersonEntity;
|
||||
|
||||
beforeAll(async () => {
|
||||
[server, app] = await testApp.create();
|
||||
app = await testApp.create();
|
||||
server = app.getHttpServer();
|
||||
personRepository = app.get<IPersonRepository>(IPersonRepository);
|
||||
});
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ describe(`${ServerInfoController.name} (e2e)`, () => {
|
|||
let nonAdmin: LoginResponseDto;
|
||||
|
||||
beforeAll(async () => {
|
||||
[server] = await testApp.create();
|
||||
server = (await testApp.create()).getHttpServer();
|
||||
|
||||
await testApp.reset();
|
||||
await api.authApi.adminSignUp(server);
|
||||
|
|
|
@ -48,7 +48,7 @@ export default async () => {
|
|||
|
||||
process.env.NODE_ENV = 'development';
|
||||
process.env.TYPESENSE_ENABLED = 'false';
|
||||
process.env.IMMICH_MACHINE_LEARNING_ENABLED = 'false';
|
||||
process.env.IMMICH_TEST_ENV = 'true';
|
||||
process.env.IMMICH_CONFIG_FILE = path.normalize(`${__dirname}/immich-e2e-config.json`);
|
||||
process.env.TZ = 'Z';
|
||||
};
|
||||
|
|
|
@ -33,7 +33,8 @@ describe(`${SharedLinkController.name} (e2e)`, () => {
|
|||
let app: INestApplication<any>;
|
||||
|
||||
beforeAll(async () => {
|
||||
[server, app] = await testApp.create();
|
||||
app = await testApp.create();
|
||||
server = app.getHttpServer();
|
||||
const assetRepository = app.get<IAssetRepository>(IAssetRepository);
|
||||
|
||||
await testApp.reset();
|
||||
|
|
|
@ -11,7 +11,7 @@ describe(`${SystemConfigController.name} (e2e)`, () => {
|
|||
let nonAdmin: LoginResponseDto;
|
||||
|
||||
beforeAll(async () => {
|
||||
[server] = await testApp.create();
|
||||
server = (await testApp.create()).getHttpServer();
|
||||
|
||||
await testApp.reset();
|
||||
await api.authApi.adminSignUp(server);
|
||||
|
|
|
@ -18,7 +18,8 @@ describe(`${UserController.name}`, () => {
|
|||
let userRepository: Repository<UserEntity>;
|
||||
|
||||
beforeAll(async () => {
|
||||
[server, app] = await testApp.create();
|
||||
app = await testApp.create();
|
||||
server = app.getHttpServer();
|
||||
userRepository = app.select(AppModule).get(getRepositoryToken(UserEntity));
|
||||
});
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ interface TestAppOptions {
|
|||
let app: INestApplication;
|
||||
|
||||
export const testApp = {
|
||||
create: async (options?: TestAppOptions): Promise<[any, INestApplication]> => {
|
||||
create: async (options?: TestAppOptions): Promise<INestApplication> => {
|
||||
const { jobs } = options || { jobs: false };
|
||||
|
||||
const moduleFixture = await Test.createTestingModule({ imports: [AppModule], providers: [AppService] })
|
||||
|
@ -85,12 +85,11 @@ export const testApp = {
|
|||
await app.get(AppService).init();
|
||||
}
|
||||
|
||||
const httpServer = app.getHttpServer();
|
||||
const port = httpServer.address().port;
|
||||
const port = app.getHttpServer().address().port;
|
||||
const protocol = app instanceof Server ? 'https' : 'http';
|
||||
process.env.IMMICH_INSTANCE_URL = protocol + '://127.0.0.1:' + port;
|
||||
|
||||
return [httpServer, app];
|
||||
return app;
|
||||
},
|
||||
reset: async (options?: ResetOptions) => {
|
||||
await db.reset(options);
|
||||
|
|
Loading…
Reference in a new issue